2 Replies Latest reply on Sep 16, 2008 8:01 PM by flashharry!

    Splice Array collection after its been filtered

    flashharry! Level 1
      I have a datagrid and I'm paging the data.

      I have the original array collection and a 2nd one that gets created out of a splice of the original one

      pagedDetailedAssetReport = new ArrayCollection( detailedAssetReport.source.slice((start * pageSize),(start * pageSize) + pageSize) );

      I have to splice the source of the first array collection.

      If I run a filter the 1st array collection is filtered correctly, but of course when I splice the source it ignore the filtered data and uses the original data.

      So basically, how can I splice the filtered data of array collection 1

      Thanks

        • 1. Re: Splice Array collection after its been filtered
          Level 7

          "flashharry!" <webforumsuser@macromedia.com> wrote in message
          news:gapodb$88h$1@forums.macromedia.com...
          >I have a datagrid and I'm paging the data.
          >
          > I have the original array collection and a 2nd one that gets created out
          > of a
          > splice of the original one
          >
          > pagedDetailedAssetReport = new ArrayCollection(
          > detailedAssetReport.source.slice((start * pageSize),(start * pageSize) +
          > pageSize) );
          >
          > I have to splice the source of the first array collection.
          >
          > If I run a filter the 1st array collection is filtered correctly, but of
          > course when I splice the source it ignore the filtered data and uses the
          > original data.
          >
          > So basically, how can I splice the filtered data of array collection 1

          Look at the toArray method of ArrayCollection.

          HTH;

          Amy


          • 2. Re: Splice Array collection after its been filtered
            flashharry! Level 1
            I figured out the issue.

            I made a 3 array collection that would store my filtered original. I could then use the 3 array collection length to correctly calculate the paging needed

            private function refreshDataProvider(start:uint):void{
            detailedFiletredAssetReport = new ArrayCollection(detailedAssetReport.source.filter(actionFilter));
            pagedDetailedAssetReport = new ArrayCollection( detailedFiletredAssetReport.source.slice((start * pageSize),(start * pageSize) + pageSize) );
            }