[flexcoders] How to Highlight selected item in mx:List after change of data provider

2007-09-26 Thread falgunisachde
Hello,
I am using mx:List which is bind to dataprovider of Collection type.
On some particular event.The dataprovider list is getting updated,so I
need to refresh Listbox with updated listvalues and set selected index
again to the same.
I am able to refresh the collection and set selected index again.But I
am not able to show the selected Item highlighted (eg. I dont able to
show selected item in blue color as it was before)

Can you people provide me some hint regarding how to set style or call
render for highlighting the particular item in Listbox?

Thanks in advance.




RE: [flexcoders] How to Highlight selected item in mx:List after change of data provider

2007-09-26 Thread Alex Harui
This test worked for me:
 
?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; 
 layout=vertical 
 mx:Script
 ![CDATA[
 public var arr:Array = [{ label: alpha}, {label:beta},
{label:gamma}, {label:delta}];
 
 public function refresh():void
 {
  var si:int = list.selectedIndex;
  list.dataProvider = [{ label: alpha}, {label:beta},
{label:gamma}, {label:delta}];
  list.selectedIndex = si;
 }
]]
 /mx:Script
mx:List id=list /
mx:Button click=refresh() /
mx:Label text={list.selectedIndex} /
/mx:Application




From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of falgunisachde
Sent: Wednesday, September 26, 2007 6:20 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] How to Highlight selected item in mx:List after
change of data provider



Hello,
I am using mx:List which is bind to dataprovider of Collection type.
On some particular event.The dataprovider list is getting updated,so I
need to refresh Listbox with updated listvalues and set selected index
again to the same.
I am able to refresh the collection and set selected index again.But I
am not able to show the selected Item highlighted (eg. I dont able to
show selected item in blue color as it was before)

Can you people provide me some hint regarding how to set style or call
render for highlighting the particular item in Listbox?

Thanks in advance.