开发者

Flex: Reverse Order of ArrayCollection so that the Last Item Appears First in a ComboBox

Is there a way to reverse the order of the items in a comboBox? I'd like to use index numbers to refer to items in the arrayCollection below. I want the newest content to appear first in the comboBox. But, if I add something above the first item then all of the index numbers will be off by one. If I could add a new i开发者_运维知识库tem to the end of the arrayCollection, but have it appear first in the comboBox drop down that would solve a lot of problems.

<mx:ComboBox  id="MyComboBox" change="handler(event);"   prompt="Make a Selection">
    <mx:ArrayCollection id="myDP">
        <mx:Object  id="first" label="Label 1" series="2"  pageTitle="Title 1"/>
        <mx:Object  id="second" label="Label 2" series="7" pageTitle="Title 2"/>                                        
        <mx:Object  id="third" label="Label 3" series="9"  pageTitle="Title 3"/>                                        
    </mx:ArrayCollection>
</mx:ComboBox>

Any suggestions?

Thank you.

-Laxmidi


I would do this by adding a Sort to your ArrayCollection. Here's an example: Sorting an ArrayCollection using the SortField and Sort classes


Simply you can use the method myDP.source.reverse()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜