Skip navigation
Currently Being Moderated

how to detect DataGrid Header Click with no sort

Oct 22, 2007 10:42 AM

I would like to have a datagrid where the user can click on the header, but I don't want the columns to sort, I would like to capture the column index.

If I set the property sortableColumns = false, the headerRelease event is not fired.

Can anyone suggest how I can accomplish this?

  • Currently Being Moderated
    Oct 22, 2007 12:32 PM   in reply to enfantterrible-tijzQ7
    I think you are still triggering an itemClick.

    <mx:DataGrid itemClick="trace(event.columnIndex)" sortableColumns="false">
    should tell you the col index of the clicked column.

    hope that helps.
    Mark as:
  • Currently Being Moderated
    Oct 22, 2007 1:14 PM   in reply to enfantterrible-tijzQ7
    Use headerRelease and then prevent the default event:

    In the datagrid: headerRelease="jumpBack(event)"

    In your script:

    private function jumpBack(event:DataGridEvent) : void {
    //do something here
    Mark as:
  • Currently Being Moderated
    Aug 20, 2009 9:00 AM   in reply to Handycam

    Hey.. do you know how to get the sorting order, don't see that in the event conten.I need to know if the data is sorted asc or desc..



    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points