Question

(I'm using Cairngorm) I have a combobox that displays items form an XMLListCollection that's in my model. I want to only view the items (XML) whose "sent" properties is false.. like item.sent == 'false'. This filter must apply only to this specific combobox, not everything that's bound to the XMLListCollection source. And of course it must update and refresh the filter if the source changes..

How can I do it? I'm trying to use filterFunction but don't understand how it works... thanks

Was it helpful?

Solution

Actually, you don't have to copy all the data, as Christophe says. You can create another ListCollectionView which is actually a view of some list and apply filter to it. So if xmlListCollection is your collection, you can try the following code:

var listView:ListCollectionView = new ListCollectionView(xmlListCollection.list);
listView.filterFunction =  someFunction;
listView.refresh();

listView should be always in sync with your collection, unless you swap underlying xmlListCollection source or list.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top