Monday, May 18, 2009

Use FilterFunction in Flex ArrayCollection

Here is the simple Flex ArrayCollection FilterFunction example to ignore blank records (name) form arrayCollection.


var ac=new ArrayCollection();
ac.addItem({name:'abc'});
ac.addItem({name:'xyz'});
ac.addItem({name:''});
ac.addItem({name:'dac'});

// use of fillter function
ac.filterFunction = function(item:*):Boolean{
return (StringUtill.trim(item.name)!=""); //
}
ac.refresh();



Now filtered ArrayCollection object use further code.

1 comment: