(This was originally logged at https://code.google.com/p/flex-autocomplete/issues/detail?id=10)
What steps will reproduce the problem?
- Create an AutoComplete component with a dataProvider that has a filterFunction that removes some of the items from the ListCollectionView, e.g. roughly:
var dp = new ListCollectionView(...);
dp.filterFunction = someFilterFunction;
someAutoComplete.dataProvider = dp;
- Then type something in the displayed AutoComplete box.
What is the expected output? What do you see instead?
I expected that the AutoComplete's drop-down list contained items that matched the filterFunction that was initially set on the dataProvider and also matched the search text. Instead, the drop-down displayed all items that matched the search text, regardless of whether they matched the original filterFunction.
What version of the product are you using? On what operating system?
flex-autocomplete 1.2-fx4 on Mac OS X
Please provide any additional information below.
This happens because the AutoComplete component overwrites the filterFunction of its dataProvider with its own function.
A fix would be to change the AutoComplete component to wrap the dataProvider that it is given in another ListCollectionView and to set the filterFunction on the wrapper. The issue can also be worked around without modifying the AutoComplete component by passing an already-wrapped ListCollectionView to the AutoComplete.
Note: It is possible that this is intended behavior. But I found it surprising so I think it is might be a genuine bug. If you are happy that this is a bug then I can send a pull request to fix it.