Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8157961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:28:04+00:00 2026-06-06T17:28:04+00:00

I have several objects like this: I want to move type and value one

  • 0

I have several objects like this:

enter image description here

I want to move type and value one step up so they will be next to field, and then delete data.
It looks like this when departments is converted to JSON:

[
    {"field"    : "DEPARTMAN_NO",
     "data"     : { "type":"numeric" , "comparison":"eq" , "value":11 }
    },
    {"field"    : "DEPARTMAN_ADI",
     "data"     : { "type":"string" , "value":"bir" }
    }
]

I have tried:

departments = grid.filters.getFilterData();
i = {};
for(var i in department) {
department = i.data;
delete.department.data;
};

but it dosen’t work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T17:28:07+00:00Added an answer on June 6, 2026 at 5:28 pm

    1) First, loop departments, each item we call it department;
    2) You want to move department.data‘s properties to department, From another angle, you can move department‘s properties to department.data and return department.data, code like:

    var departments = [{
            "field": "DEPARTMAN_NO",
            "data": {
                "type": "numeric",
                "comparison": "eq",
                "value": 11
            }
        }, {
            "field": "DEPARTMAN_ADI",
            "data": {
                "type": "string",
                "value": "bir"
            }
        }],
        department;
    
    for (var i = 0, len = departments.length; i < len; i++) {
        department = departments[i]; // department
        for (var key in department) {
            if (key !== 'data' && department.data) {
                department.data[key] = department[key];
            }
        }
        departments[i] = department.data || department; // if no department.data, no change
    }
    
    console.log(departments);
    

    result:

    enter image description here

    view the full demo http://jsfiddle.net/KVYE5/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an object whose value may be one of several array types like
I have a class that is called regularly by several objects. I would like
I have several objects set up in Core Data, one of which is Deck
We have several Flash objects included in our project. We call each one a
During coding I frequently encounter this situation: I have several objects ( ConcreteType1 ,
I have several distinct View objects, stored in the views array, that I want
Let's imagine we have several type of elements, and we want to create a
I have several objects of type Item. The items are ordered but their ordering
suppose I have several objects of type MovieClip on my stage and when MouseEvent.MOUSE_DOWN
I would like to have several Cache objects in my application and I'd like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.