Results 1 to 3 of 3

Thread: Ext.Flatten Not flatening array correctly

  1. #1
    Sencha User
    Join Date
    Apr 2008
    Posts
    330
    Vote Rating
    0
      0  

    Question Ext.Flatten Not flatening array correctly

    Hello All,

    Its the first time I'm using the Ext.flatten and I don't know if it behaving properly. I have the flowing array of arrays which I would like to be in 1 single array.

    From my understanding the Ext.flatten should return all the elements (C_MGMT.. : VALUE) into 1 array {}.

    Thanks in advance for any assistance in this matter.

    /J


    Code:
    [{},
    {"C_MGMT_ID":"","CUST_ID":"1","C_MGMT_TARGET_TYPE":"Server","C_MGMT_TARGET":"858","CHANGE_MGMT_PRIORITY":"P1- High"},{"C_MGMT_USER":"ADMIN","C_MGMT_START_DATE":"2011-06-16 15:47:11","C_MGMT_END_DATE":"2011-06-16 15:47:14","C_MGMT_OUTAGE":"NO","C_MGMT_EXT_REF":"13591","C_MGMT_EST_TIME":"1"},{"C_MGMT_SUBJECT":"Replace 2 disks","C_MGMT_DESCRIPTION":"Replace 2 disks","C_MGMT_REASON":""},{}]

  2. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,790
    Vote Rating
    390
      0  

    Default

    You do not have an array of arrays, you have an array of objects.

    By the sounds of it you're looking to merge the objects into one object? For that you'd use either Ext.apply() or Ext.applyIf(). Possibly something like this to merge an array of objects in a single object called obj:

    Code:
    var obj = {};
    
    Ext.each(array, function(entry) {
        Ext.apply(obj, entry);
    });

  3. #3
    Sencha User
    Join Date
    Apr 2008
    Posts
    330
    Vote Rating
    0
      0  

    Thumbs up [SOLVED] - Ext.Flatten Not flatening array correctly

    Hello,

    Thanks, that was the solution using Ext.apply!

    /J

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •