Search code examples
actionscript-3apache-flexactionscriptadvanceddatagrid

sorting column data in advanceddatagrid flex while displaying


I am new to working on flex. I looked at several stackoverflow questions but they didnt seem to answer my question.

I am using Advanced data grid column to display my data in a table. I know that columns can be sorted using the controls on the table being displayed.

But is there a way to sort data based on a single column when the data gets displayed. I used sortDescending ="true" attribute but no change in the data.

Any help is much appreciated


Solution

  • Try to dispatch event

     var adgEvent:AdvancedDataGridEvent =
            new AdvancedDataGridEvent(AdvancedDataGridEvent.SORT, false, true);
    
        adgEvent.columnIndex     = columnIndex;
        adgEvent.dataField       = dataField;
        adgEvent.triggerEvent    = triggerEvent;
        adgEvent.multiColumnSort = false;
    

    on your AdvancedDataGrid to sort some column