[ https://issues.apache.org/jira/browse/FLEX-14936?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Justin Mclean updated FLEX-14936: --------------------------------- Labels: easytest (was: ) > List selectedItem and selectedIndex not updated on refresh() using empty array > ------------------------------------------------------------------------------ > > Key: FLEX-14936 > URL: https://issues.apache.org/jira/browse/FLEX-14936 > Project: Apache Flex > Issue Type: Bug > Components: mx: List > Affects Versions: Adobe Flex SDK 3.0 (Release) > Environment: Affected OS(s): All OS Platforms > Browser: Firefox 2.x > Language Found: English > Reporter: Adobe JIRA > Labels: easytest > > Steps to reproduce: > 1. Run the following test application in debug mode > 2. Select the last item in the list, and then click the "Delete Last Item" > button > 3. Look at the trace output to see the problem when deleting the last item in > the array. > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" > initialize="init()"> > <mx:Script> > <![CDATA[ > private var items:Array = [ "One", "Two", "Three" ]; > private function init() { > list.dataProvider = items; > } > private function removeItem(event:Event) { > trace("before: selected index = " + list.selectedIndex); > items.pop(); > list.dataProvider.refresh(); > trace("after: selected index = " + list.selectedIndex); > } > ]] > > > </mx:Script> > <mx:Button label="Delete Last Item" click="removeItem(event);" /> > <mx:List id="list" width="100"/> > </mx:Application> > > Actual Results: > After each deletion, the selectedIndex property on the list should be -1, > indicating no selection since the previously selected item was deleted. > > Expected Results: > Works as expected until the final element is removed. In that case the list > still shows the selectedIndex as 0 (not -1) > > Workaround (if any): > Check if (list.dataProvider.length == 0) after doing the refresh(), and > manually set selectedIndex = -1. > -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira