How do you re-sort a Grid after a value has been edited through the Grid Ed

So let’s say I have:

getDataProvider().refreshItem(getMyItem());

Which then updates the item in the Grid however let’s say that one of the values edited is in the column which is sorted. When the save is completed the Grid does not re-sort it’s data so the item is now incorrectly located in the Grid.

How I can re-sort the Grid and preferably keep the just edited row selected and on the screen?

When the save is completed the Grid does not re-sort

No, it is not triggered automatically, since sort is heavy operation, and in most cases you do not want that. So you need to do programmatic sort with grid.sort(…) method.

keep the just edited row selected

grid.select(item);

and on the screen

This is less trivial, since grid.scrollTo(row) takes row index as parameter. So you need to dig out from your data source on which row bean is. One alternative is use DataCommunicator.fetchItemsWithRange(…) since it returns the set of items in sorted order. Remind, if you have big data source, it is heavy operation.