1 Reply Latest reply on May 19, 2008 12:34 PM by javamonjoe

    DataGrid - update contents and maintain sort selection

    anoweb
      I have a DataGrid whose 'dataProvider' is bound to an ArrayCollection. At some points in time the ArrayCollection is replaced with a new set of data provided to the application. This causes the DataGrid to be reloaded essentially, which also causes the users sort selection to be reset. How can I keep the sort selection when replacing the data?
        • 1. Re: DataGrid - update contents and maintain sort selection
          javamonjoe Level 1
          There may be an easier way to do this, but I set a headerRelease handler on the dataGrid and keep track of which column is being sorted. When it is time to replace the dataProvider, it is possible to sort my dataProvider based on the last user click of the header.

          It's not elegant, but it works. With this method I'm able to store the user's preferred sort between executions. (that would be application executions. Not the user)