Flex Filterfunction - Filter by Array of values
- by Anandh
How to filter an Arraycollection by "array of values" rather than a single value (simple comparision) , the below code snippet is for filtering by single value now I went into scenario like filter out only price [10,4,1,8] (some random values from the master collection). Is there any better way to do the second code snippet
Filter function simple comparision
private function filterForTestData(item:Object):Boolean{
if(item.price < slider.value) return true;
else return false;
}
Filter by array of values
private function filterForTestData(item:Object,filterBy:Array= [10,4,1,8]):Boolean{
for(randomprice in filterBy)
return item.price == randomprice;
}
[Edited]
Apply Filter
testData.filterFunction = filterForTestData;