I am sorting xmllist profilexml. In the list dates and months are sorted using SortField
. It is sorting up to September month. After that Oct, Nov, and Dec are coming and displaying on the top in the datagrid.
finalList = new XMLListCollection(profileXml);
var sortL:Sort = new Sort();
sortL.fields开发者_开发技巧 = [new SortField("startDate", true)];
finalList.sort = sortL;
finalList.refresh();
popupProfile.dataGrid.dataProvider = finalList;
My XmlList is in this format: <startDate>1/11/2011</startDate>
.
<startDate>2/15/2011</startDate>
as per my understanding it is sorting until 0-9 numeric fields only. Is there anything I need to add in this code for numeric sorting?
You could try a couple of things:
- Set the numeric property of your
[SortField][1]
to true.
sortL.fields= [new SortField("startDate", true, false, true)];
Convert your date from a string into an actual Date object before performing the sort.
If you're sorting in a
DataGrid
, you can use your ownsortCompareFunction
. FlexExamples has an example for this one.This question might also help.
精彩评论