Copy link to clipboard
Copied
Hello,
I have a datagrid control that i want to be sorted by two fields instead one. (it works fine with one filed though)
I am using the method SortItemsOn() which according the documentation, Sorts the elements of the current data provider by one or more of its fields.
However if i add two fields i get some weird result. e.g.
datagrid.sortItemsOn("Field1 Field2", Array.NUMERIC);
The Field1 is of date data type and the Field2 is textual field so maybe that's why it does not give the expected result.
Thank you so much
i don't know of any for flash. there are several for flex.
but for flash, just make your own using a custom sort. eg,
function sortGridF():void{
var dp:DataProvider = datagrid.dataProvider;
dp.sortOn(["Field1, Field2"], Array.NUMERIC);
}
p.s. please mark correct/helpful responses.
Copy link to clipboard
Copied
that method only accepts one field. to sort on two fields you'll need to create your own sorter.
Copy link to clipboard
Copied
Hmm then why the documentation says that it "Sorts the elements of the current data provider by one or more of its fields"
SelectableList - Adobe ActionScript® 3 (AS3 Flash) API Reference
Copy link to clipboard
Copied
couldn't tell you that but it only accepts a string in the first parameter and there's no way to indicate multiple columns with one string.
Copy link to clipboard
Copied
I see. Ok could you please show me or give me a link where i can see an example of multiple fields sorter? Would be greatly appreciated. Thx
Copy link to clipboard
Copied
i don't know of any for flash. there are several for flex.
but for flash, just make your own using a custom sort. eg,
function sortGridF():void{
var dp:DataProvider = datagrid.dataProvider;
dp.sortOn(["Field1, Field2"], Array.NUMERIC);
}
p.s. please mark correct/helpful responses.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now