Hi,
I am trying to create a dynamic datagrid in Flex 3, I have a list of columns a list of objects which correspond to datapoints for those columns which I fetch from a url. While the grid works perfectly fine the problem is that sorting on the columns is done in lexical order.
I am aware that this can be fixed by adding a sortcomparefunction to a column, which is not easy for this case. I have tried doing
var dgc:DataGridColumn = new DataGridColumn(dtf);
f1[dtf] = function(obj1:Object, obj2:Object):int {
return Comparators.sortNumeric(obj1[dtf],obj2[dtf]);
};
dgc.sortCompareFunction = f1[dtf];`
But the problem is that the function object that I am creating here is being overwritten in every iteration (as I am adding columns) and eventually all the columns will have sorting done only on the last column added.
Suggestions please.