3

When you create a Grid component in Vaadin v21 and switch to multiselect mode, there is a "select all" checkbox on top. How can one disable that? There seem to be different default behaviours of the Grid and hence different solutions among Vaadin versions.

Grid<Person> grid = new Grid<>(Person.class, false);
grid.setSelectionMode(Grid.SelectionMode.MULTI);
grid.setItems(personRepository.findAll());

1 Answer 1

6

You have to get the SlectionModel from the grid, to enable or disable the "Select All" checkbox:

Grid<Person> grid = new Grid<>(Person.class, false);
grid.setSelectionMode(Grid.SelectionMode.MULTI);
((GridMultiSelectionModel<?>) grid.getSelectionModel())
      .setSelectAllCheckboxVisibility(
            GridMultiSelectionModel.SelectAllCheckboxVisibility.HIDDEN
      );
grid.setItems(personRepository.findAll());
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.