Reputation: 2653
I'm using a CellTable, which is fed data via a ListDataProvider. Currently a user can sort the CellTable columns, then click a row. Clicking a row pops up a stand alone editor next to the cell table. When the user clicks "save", the code updates the employee in the ListDataProvider, then calls:
listDataProvider.refresh();
This works, but the column sort is reset. This is not acceptable because it resets the column sort that they have used, and it is a pain to have to resort the columns after every save. Is there some way to tell the CellTable to keep its current column sort when refresh is called?
Upvotes: 1
Views: 1014
Reputation: 276
Your need to call ColumnSortEvent.fire(dataGrid, dataGrid.getColumnSortList());
if you want to recover the sort order after refresh. I think it should work the same for CellTable.
This is how we refresh the DataGrid:
selectionModel.clear(); // SingleSelectionModel
dataList.clear(); // List<Data>
dataList.addAll(newData); // List<Data>
dataProvider.flush(); // ListDataProvider<Data>
dataProvider.refresh();
ColumnSortEvent.fire(dataGrid, dataGrid.getColumnSortList()); // DataGrid<Data>
Upvotes: 1
Reputation: 2653
Ended up adding a listener on the column sort, and sorted the list in code rather than allowing the CellTable to handle the sort. This kept the sort order. I'd post the code, but I no longer have access to the code base.
Upvotes: 0