this function bellow returns the String for display in an item renderer.
public function itemToLabel(item:Object):String
As selectedLabel
property is obsolete in spark.components.ComboBox
i added this function :
public function get selectedLabel():String
{
var item:Object = selectedItem;
return itemToLabel(item);
}
But i am blocked about the public function set selectedLabel(label:String):void
is there anyone who know a function labelToItem
or another solution to set my combobox selectedLabel
Not the most performant solution, but if you don't have a ton of items in the dataprovider then this should be alright:
public function setSelectedLabel(cb:ComboBox, label:String):void
{
for each(var item:Object in cb.dataProvider)
{
if(item[cb.labelField] == label)
{
cb.selectedItem = item;
return;
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.