Take the 2-minute tour ×

I am creating the columns of a datagrid dynamically at run time and I need to allocate the sort compare function to those columns based on the data type of that column, is there a way I can pass some argument to that compare function which could tell the function what type of column is it going to operate on?


share|improve this question
possible duplicate of Flex: question about the sortCompareFunction of the DataGridColumn –  Kevin Nov 4 '12 at 17:14

1 Answer 1

up vote 1 down vote accepted

This link was helpful: Flex: question about the sortCompareFunction of the DataGridColumn

But, in my case it didnt work because the solumns are getting generated dynamically and fieldName was not getting properly filled up (it was picking the last fieldName from code)...therefore I declared a global string (local to the class) and set it to the column name on headerRelease event of the datagrid (event class would be DataGridEvent and event.dataField would give the column name (which was dynamic in my case). You can use this column inside the sortcompare function to calculate the sorting logic based on column.

share|improve this answer

Your Answer


