3 Replies Latest reply on Feb 12, 2011 8:23 PM by JoshBeall

    setting filterFunction on ArrayCollection acting as provider for DDL--and change handler not firing?

    JoshBeall Level 1

      Hi All,


      I've got a Spark DropDownList (I'm on Flex SDK 4.0, Flash Builder 4).


      That DropDownList has an ArrayCollection as its dataProvider property, and in response to user gestures, I change the filterFunction on the ArrayCollection (and call ArrayCollection.refresh()) to update the list of items in the DropDownList.  This works fine.


      However, what I wasn't expecting was that neither my change event handler, nor my valueCommit event handler gets called when the selected item in the DropDownList changes due to the filterFunction filtering out items from the ArrayCollection.


      In other words, let's say I have items A, B, and C in ArrayCollection (and thus, also as items in my DropDownList).  Item A is currently selected, but I then set the ArrayCollection.filterFunction to something, and call ArrayCollection.refresh().  Items A and B are filtered out by the filterFunction, and it disappears from the DropDownList, causing item C (the next available item after A and B) to be selected.  But, even though the selected item has changed, neither my change handler nor my valueCommit handler get called.


      I know the handlers are working, because the change handler gets called when the user selects a new item from the DropDownList, and the valueCommit handler gets called when the selectedIndex is changed programmatically in code, as expected.


      Is this a known issue?  Is there an event I can listen to so I can know when the selected item has changed in this circumstance?