Reputation: 65
I have a column with 4 fields named : a> Main, b> Forward c> Back d> Link, if I use pre-defined sorting of datagrid with the column names which will be alphabetically, then the order is c>Back b>Forward d> Link a> Main. But, I do not want to sort based on the alphabets. I prefer to sort by names of the column fields. i.e. somehow give priority to each individual column field names. Like pre-define my own order.
Is it possible in flex ?
Upvotes: 0
Views: 2363
Reputation: 17734
Write a function with the following signature and then specify it as the "sortCompareFunction" property of your DataGridColumn:
mySortCompareFunction(obj1:Object, obj2:Object):int
obj1 — A data element to compare.
obj2 — Another data element to compare with obj1.
The function should return a value based on the comparison of the objects:
Note: The obj1 and obj2 parameters are entire data provider elements and not just the data for the item.
Some sorting examples here:
Upvotes: 1
Reputation: 23044
I have a column with 4 fields named
you mean records not fields, to do what you want I think you should add one more column such as "vote" integer. and increase the value when the user click up and decrease it when the user click down... like what we have here..
Upvotes: 0