2 Replies Latest reply on Sep 23, 2008 7:57 AM by ANewFlexUser

    Merging 2 datasources at Array level

    eexposito
      I am trying to merge 2 data sources into 1 to be used as a data provider for an AdvancedDataGrid:

      Originally I have this for a single data source:

      var dsrc:Array = new Array();
      dsrc.push({col1:val1,col2:val2});
      dsrc.push({col1:val3,col2:val4});

      Now I have a second data source that I am trying to merge. So I want the final array to look like this:

      var dsrc:Array = new Array();
      dsrc.push({col1:val1,col2:val2, col3:val5, col4:val6});
      dsrc.push({col1:val3,col2:val4, col3:val7, col4:val8});

      I tried doing this ... it compiles but it doesn't work as expected:

      var dsrc:Array = new Array();

      var temp1:Array = new Array();
      temp1.push({col1:val1});
      temp1.push({col2:val2});
      temp1.push({col3:val5});
      temp1.push({col4:val6});

      dsrc.push(temp1);

      var temp2:Array = new Array();
      temp2.push({col1:val3});
      temp2.push({col2:val4});
      temp2.push({col3:val7});
      temp2.push({col4:val8});

      dsrc.push(temp2);

      Is there a proper way to merge these two?

      Thanks,
      EE