Reputation: 15925
I manually delete the selected rows in the grid using:
for(Object selectedItem: grid.getSelectedRows())
grid.getContainerDataSource().removeItem(selectedItem);
grid.getSelectionModel().reset();
According to the Vaadin documentation you need to call reset() on the selectionModel so that they are in sync, and that's great.
This all works great but only if I scroll down the grid with the mouse in the browser, so that the whole grid moves. If I don't scroll the grid in my browser then the mouse selects the wrong row by the exact number of rows that were previously selected before that row. So if I select row 2 and then delete it, then select row 3 it will in fact select row 4. If however I scroll down so that the grid view is refreshed then everything works exactly as expected and the correct row is selected.
Using Vaadin 7.7.5.
Upvotes: 0
Views: 289
Reputation: 5848
Looks like it is difficult to get the grid to refresh.
grid.clearSortOrder();
Seems to be the current workaround.
Upvotes: 0