0

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?

Thanks.

Tintin
  • 2,853
  • 6
  • 42
  • 74
  • possible duplicate of [Flex: question about the sortCompareFunction of the DataGridColumn](http://stackoverflow.com/questions/3447279/flex-question-about-the-sortcomparefunction-of-the-datagridcolumn) – Kevin Nov 04 '12 at 17:14

1 Answers1

1

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.

Community
  • 1
  • 1
Tintin
  • 2,853
  • 6
  • 42
  • 74