Reputation: 11
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"
Upvotes: 0
Views: 740
Reputation: 12357
See this ArrayCollection sorting utility:
http://cyrilmazur.com/2010/08/sort-arraycollection-flex.html
Should be a great starting/end point
Upvotes: 1
Reputation: 9897
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.
Upvotes: 0