« Sending Images From Flex to a Server | Main | Z-Order of Components in a Flex Canvas »

Binding Selected Items in a Flex List

Just a quickie.

Discovered today that if you try to programatically deselect the currently selected item in a ListBase subclass with selectedItem=null the change doesn't propagate to anything bound to {my_list.selectedItem}. In fact in my application it seems to permanently break the data binding.

Instead, to deselect a list item, do selectedIndex=-1, that seems to work.

So I've got something like:

 <mx:Button label="Clear" click="entries.selectedIndex=-1"/> 
 <mx:List id="entries" dataProvider="{my_data}"/> 
 <components:MyEntryDisplay entry="{entries.selectedItem}"/>

which is fine for me.

TrackBack

TrackBack URL for this entry:
http://www.icosagon.com/mt/mt/mt-tb.cgi/161

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)