Search code examples
apache-flexflashdatagridadvanceddatagrid

How to determine currently sorted header column in data grid?


I want to know which header the user clicked on to give the currently sorted view. Is there an API in flex framework that I can use to achieve this? Hopefully I can get back a column index so I know how it is currently sorted.

Thanks, Mike


Solution

  • The mx.controls.DataGrid has a property named columns. Each column in this collection is an object of type mx.controls.dataGridClasses.DataGridColumn with a boolean property named sortDescending.

    Otherwise, you can receive and handle the DataGrid event headerRelease. This event is transmitted when the user releases the mouse button on a column header, causing the column to become sorted.