RE: [flexcoders] filterFunction issue with shared array collection in model / shared list
create another arraycollection and assign its source to the other arraycollection's source From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of scott_flex Sent: Monday, March 26, 2007 8:11 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] filterFunction issue with shared array collection in model / shared list I have a shared arraycollection of value objects. Singeton, only one instance of this array collection. Dfferent views (in a tab navigator) are generated using this shared array collection but each view filters the data in a datagrid list with different criteria. So.. in each view i utilized the filterFunction to correctly filter the array collection and only display what i needed into my datagrid. That works great. However, when i set the filter function and refresh the arrayCollection all my other views (tab windows) change as well because they are all databound to the shared array collection... This does make sense... but not what i want. Maybe i need to put the filter on the datagrid for each view, not the array collection. Am i going about this wrong? I'm a newbie cairngorm and i believe this is an issue that others would run into.
RE: [flexcoders] filterFunction issue with shared array collection in model / shared list
Take a look at the ListCollectionView class - you can pass your 'master' ArrayCollection into its constructor (because ArrayCollection implements IList). You can then set filter options on your ListCollectionView without affecting the 'master'. So you'd probably want to create a ListCollectionView for each of your individual views: http://livedocs.adobe.com/flex/2/langref/mx/collections/ListCollectionVi ew.html You can use a ListCollectionView as a dataProvider for your datagrid controls because it implements the required interfaces (just like ArrayCollection). The ListCollectionView will also listen for changes to the underlying 'master' list and update accordingly. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of scott_flex Sent: Monday, March 26, 2007 4:11 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] filterFunction issue with shared array collection in model / shared list I have a shared arraycollection of value objects. Singeton, only one instance of this array collection. Dfferent views (in a tab navigator) are generated using this shared array collection but each view filters the data in a datagrid list with different criteria. So.. in each view i utilized the filterFunction to correctly filter the array collection and only display what i needed into my datagrid. That works great. However, when i set the filter function and refresh the arrayCollection all my other views (tab windows) change as well because they are all databound to the shared array collection... This does make sense... but not what i want. Maybe i need to put the filter on the datagrid for each view, not the array collection. Am i going about this wrong? I'm a newbie cairngorm and i believe this is an issue that others would run into.