3 Replies Latest reply on May 19, 2008 7:31 PM by ntsiii

    Merge/Concat two arrays of objects

    flashharry! Level 1
      Hi,

      This seems a simple thing but I can not find a solution.

      Has I run through some data I create an inner array and outer array

      The outer array is then made into an array collection.

      I need to concat the inner array to the outer.

      I have tried array.concat(array), ObjectUtil.copy but no joy.
      Code cut for space

      out loop {
      inner loop {
      permSet.push({permtype:'Test',value:Number(currentPerm)});
      }
      newVolume.push({label:String(volume.@label),path:String(volume.@volpath),subpath:String(v olume.@subpath),modtime:String(volume.@modtime)});
      }
      volumeList = new ArrayCollection(newVolume);

      Thanks in advance
      Dean
        • 1. Re: Merge/Concat two arrays of objects
          ntsiii Level 3
          Not following. Maybe you cut too much code. i can't tell what you want to do. Be a bit more verbose, use the Attach Code window so you code does not lose its formatting.
          Tracy
          • 2. Re: Merge/Concat two arrays of objects
            flashharry! Level 1
            I want to end up with a data grid that shows all the data from both arrays per row

            The volume permissions are a integer of a binary representation. So I convert the integer back to binary and split to an array. Now I have a array with 32 elements either on or off (1 or 0), representing arbitrary user permissions per volume.

            We skip 3 of the elements as there not used. But I end up with an array "permSet" of 29 object either 1 or 0.
            Now I want to add these 29 elements to the outer array "newVolume" so I end up with the original 4 elements plus the 29 from the inner array, my grid will end up with 33 columns, 29 of which will be an item renderer of tick marks

            I hope that makes more sense,

            Thanks in advance
            Dean
            • 3. Re: Merge/Concat two arrays of objects
              ntsiii Level 3
              Could you not create your base volume object above the inner loop, then in the loop, add each permSet elemtne to that object?
              Tracy