Number of items in a combobox in Flex
HI开发者_开发问答, How do i retreive the total number of items (count) of a combo box in Flex?
random idea for you:
var dp : Object = combobox.dataProvider ;
if(dp is Array)
{
//do something cool
}
else if(dp is ArrayCollection){
//do something equally as cool
}
etc...
I've confirmed that this will work:
(comboBox.dataProvider as ArrayCollection).length
Try using:
combobox.collection.length
where combobox
is the combobox you are using
I'm not sure this will work though. You may need to subclass the control because collection is a protected member :(
The dataprovider of combobox is an arraycollection. You can use the length property to count the number.
精彩评论