Changing the width of dropdown area in flex combobox.
Posted
by DineshDu
on Stack Overflow
See other posts from Stack Overflow
or by DineshDu
Published on 2010-03-08T09:13:18Z
Indexed on
2010/05/17
19:40 UTC
Read the original article
Hit count: 227
I have a combobox which gets populated by a remote method. I need to set the dropdownwidth of the combobox to the maximum length of the item in the combobox. I am able to achieve it by the following code. But if the resolution of the screen changes, the result is not similar. Is there any way to find the display width of the text in the dropdown?
private function getGroupData(resultEvent:ResultEvent):void{
viewCbx.dataProvider = resultEvent.result as ArrayCollection;
var comboDp:ArrayCollection = viewCbx.dataProvider as ArrayCollection;
var dropWidth:int = 0;
for each(var obj:Object in comboDp){
if(obj.groupName.length > dropWidth){
dropWidth = obj.groupName.length;
}
}
viewCbx.dropdownWidth = dropWidth*6;
}
© Stack Overflow or respective owner