1

Problem:

I have a grid with lazy loading and therefore my data is not in memory.

To show the check box to select/deselct all i used this Question. My code looks like this:

Grid<CustomClass> grid;
...
// set selection mode
grid.setSelectionMode(SelectionMode.MULTI);
// make select all check box visible
GridSelectionModel<CustomClass> selectionModel = grid.getSelectionModel();
((GridMultiSelectionModel<CustomClass>) selectionModel)
    .setSelectAllCheckboxVisibility(SelectAllCheckboxVisibility.VISIBLE);

The Problem is, that the check box does not work in the UI as you can see:

enter image description here

If i log the selected items with the following code the check box works as expected

grid.addSelectionListener(l -> {
    log.info("selected: " + l.getAllSelectedItems().size());
});

Question:

What can i do that the check box also works in the UI?

Anna Koskinen
  • 1,362
  • 3
  • 22
MrMaavin
  • 1,611
  • 2
  • 19
  • 30

1 Answers1

1

The Solution i found that the checkoxes are updated in the UI is to add dataPovider.refreshAll() in the listener.

Code of the Solution:

grid.addSelectionListener(l -> {
    ...
     dataPovider.refreshAll();
    ...
});
MrMaavin
  • 1,611
  • 2
  • 19
  • 30