The recipe for conditional selection requires a server-side check in order to discard selections that are not perfomed through the item click listener (which already does its own filtering).
However, grid.addSelectionListener() is just a shorthand for grid.getSelectionModel().addSelectionListener() and the selection listener is lost after a call to grid.setSelectionMode().
This limitation implies that GridHelpers.setSelectionFilter must be called after grid.setSelectionMode. If you need to change the selection mode, you need to set the same selection filter again:
GridHelper.setSelectionFilter(grid, GridHelper.getSelectionFilter(grid)); // static call
grid.setSelectionFilter(grid.getSelectionFilter()); // with lombok extension
The recipe for conditional selection requires a server-side check in order to discard selections that are not perfomed through the item click listener (which already does its own filtering).
However,
grid.addSelectionListener()is just a shorthand forgrid.getSelectionModel().addSelectionListener()and the selection listener is lost after a call togrid.setSelectionMode().This limitation implies that
GridHelpers.setSelectionFiltermust be called aftergrid.setSelectionMode. If you need to change the selection mode, you need to set the same selection filter again: