1 Reply Latest reply on Dec 8, 2009 9:17 PM by PhilipKeiter

    Unsort a DataGrid Column

      short version:
      Is there a clever way to "un-sort" a datagrid column so the Column and Grid will go back to the original pre-sorted state?--not just remove the ability to sort.

      long-winded background:
      I'm using a ComboBox to toggle between report views (which are displayed in a DataGrid). I have 2 views: the All View and the Grouped View. The trouble I'm having is that once a column in my DataGrid gets sorted by a User (which is desirable) in the All View, then when the User toggles to the Grouped View the sort is still in place for the column (not desirable). Upon toggle (via ComboBox change event), I first clear out the DataProvider of all data, then I'm setting the "sortable" property of the individual columns and the DataGrid to be 'false' and then I'm repopulating the DataProvider with fresh data. The result is that the ability to sort the datagrid is indeed taken away from the User, but the new data still appears sorted by the column.

      dataAC.removeAll(); // ArrayCollection DataProvider to my DataGrid
      // Grouped View
      for (var j:int=0;j<graphDG.columns.length;j++) {
      var dgc: DataGridColumn = graphDG.columns[j] as DataGridColumn;
      dgc.sortable = false;
      graphDG.sortableColumns = false;

      ...// refill dataAC