Each time I have to implement an array filter, I find myself deeply impressed with the Flex ArrayCollection Filterfunction feature.
If only they had it in Flash... If you are not familiar with it - here goes:
If only they had it in Flash... If you are not familiar with it - here goes:
FilterFunction is an ArrayCollection property allowing the definition of filter conditions for the data.
The function receive each object from the array and decide if it should be filtered out or not.
The result is returned as a boolean value.
The result is returned as a boolean value.
Since this function can combine as many validation terms as we wish, it can easily implement multiple filters.
Here is a little sample. Just type inside the Filter field:
I used "toLowerCase" in order to disable the case sensitivity.
Also, the function looks for the input text anywhere in each listed country (not only at the beginning).
Also, the function looks for the input text anywhere in each listed country (not only at the beginning).
And yes, I know not all the countries are listed...
Source code is here.
No comments:
Post a Comment