Thanks Beau 
--- In flexcoders@yahoogroups.com, Beau Scott <beau.sc...@...> wrote:
>
> The sorting is stored on the ListCollectionView dataProvider of each list
> control. If you set the list controls to share the same ListCollectionView,
> the sorting will be common. If you set the dataprovider to each control to
> be a non-ListCollectionView object (an array for example, instead of an
> ArrayCollection), the sorting will be unique between the two as different
> ArrayCollection objects will be created to wrap the same source array, but
> data will not be duplicated. There are some caveats: The ListCollectionView
> also handles update events, so if you change the data in one list control,
> it won't be shown in the other until you call other.dataProvider.refresh(),
> and this can be a heavy operation as it has to reindex, sort and seek.
> Here's an example:
> 
> =====================================================
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> layout="horizontal" xmlns:local="*">
>     <mx:Script>
>         <![CDATA[
> 
>             [Bindable]
>             public var regionData:Array = [
>                 {region: "Asia", country: "China", rep: "Bill"},
>                 {region: "Asia", country: "S. Korea", rep: "Bill"},
>                 {region: "Asia", country: "N. Korea", rep: "Sue"},
>                 {region: "Asia", country: "Thailand", rep: "Phil"},
>                 {region: "Euorpe", country: "United Kingdom", rep: "Bill"},
>                 {region: "Euorpe", country: "France", rep: "Sue"},
>                 {region: "Euorpe", country: "Italy", rep: "Phil"},
>                 {region: "Euorpe", country: "Germany", rep: "Bill"},
>                 {region: "Africa", country: "Zimbabwe", rep: "Phil"},
>                 {region: "Africa", country: "S. Africa", rep: "Sue"},
>                 {region: "Africa", country: "Kenya", rep: "Bill"},
>                 {region: "Africa", country: "Egypt", rep: "Phil"},
>                 {region: "N. America", country: "U.S.A.", rep: "Bill"}
>             ];
> 
>             private function addMore():void
>             {
>                 right.dataProvider.addItem(
>                    {region: "N. America", country: "U.S.A.", rep: "Beau"}
>                 );
>             }
>         ]]>
>     </mx:Script>
> 
>     <mx:DataGrid id="left" dataProvider="{regionData}" height="100%"
> width="50%">
>         <mx:columns>
>             <mx:DataGridColumn dataField="region" />
>             <mx:DataGridColumn dataField="country" />
>             <mx:DataGridColumn dataField="rep" />
>         </mx:columns>
>     </mx:DataGrid>
> 
>     <mx:DataGrid id="right" dataProvider="{regionData}" height="100%"
> width="50%">
>         <mx:columns>
>             <mx:DataGridColumn dataField="region" />
>             <mx:DataGridColumn dataField="country" />
>             <mx:DataGridColumn dataField="rep" />
>         </mx:columns>
>     </mx:DataGrid>
> 
>     <mx:VBox>
>         <mx:Button click="addMore()" label="Add to right grid" />
>         <mx:Button click="left.dataProvider.refresh();" label="refresh left"
> />
>     </mx:VBox>
> 
> </mx:Application>
> =====================================================
> 
> 
> Note that you can sort the datagrids independent of eachother. If you click
> "add to right grid", a new line item will be added to the right grid only.
> It has been added to the regionData Array, as well, but becase Array is not
> an event dispatcher, the left grid is not automatically refreshed. If you
> click the refresh button, the dataProvider for left is refreshed and the new
> lines show up.
> 
> 
> Hope this helps,
> 
> Beau
> 
> 
> 
> 
> On Mon, Aug 31, 2009 at 8:54 AM, ilikeflex <ilikef...@...> wrote:
> 
> >
> >
> > Hi
> >
> > I have array collection as a data provider. I have two different views.
> > User can do sorting in different views.
> >
> > But i want that the one view is not affected by another.I know i can keep
> > two different copies of dataprovider for different views.
> >
> > Is there any other way. Actually my dataprovider has more than 25,000
> > records.
> >
> > Need your suggestions.
> >
> > Thanks
> > ilikeflex
> >
> >  
> >
> 
> 
> 
> -- 
> Beau D. Scott
> Software Engineer
>


Reply via email to