简体   繁体   中英

Flex Builder, How do I sort this time ArrayCollection?

How do I sort this time ArrayCollection? I need it to be sorted from earliest to latest.

"8:00am"
"2:00pm"
"10:00am"
"11:00am"
"12:00pm"
"7:00am"
"3:00pm"
"4:00pm"

See this ArrayCollection sorting utility:

http://cyrilmazur.com/2010/08/sort-arraycollection-flex.html

Should be a great starting/end point

Actually, this is collection of strings. To sort it, get Array from ArrayCollection with source property. Look into Array.sort method. You'll need to implement compare function to pass into sort method. The thing that left is how to tell which date is later - you can try parseDate, or break string into parts and count number of hours yourself.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM