Vaadin 8 Grid: Missing 'Select All' Checkbox

I am migrating my application to Vaadin8.
I noticed that the header entry for Select All Rows is not present in multiselect tables when there is an extra Header Row (it works OK when there is a single Header Row).
Is that a bug or do I miss a setting in my application?
See attached
39703.png

Looks like a bug to me - do you mind filing a ticket at
https://github.com/vaadin/framework/issues
?

-Olli

Done, thanks.

I could not reproduce the problem in a minimal test UI with Vaadin 8.1.6 or 8.1.7:



See the full sample on vaadinfiddle.com

The Checkall checkbox is always visible even when there is additional header rows. Could you share an example project where the problem exists?

Maybe your theme has some customizations that make the checkbox hidden?

I wonder if I misstated the root problem, as the table that has double header rows is also a not in-memory data provider. Perhaps select all is only available for in-memory data providers?

Ah, you are right! Select all is by default disabled by default when using a lazy loading data provider.
Here’s how to enable it and further discussion about the implications:

https://github.com/vaadin/framework/issues/8158#issuecomment-281040611

Just for letting others know what I did based on the advice above: upon loading the count query from my lazy-loaded grid, I check if it is over a certain limit (500 rows, but might change it), and depepnding on the value I enable or disable the Select All box.
Furthermore, we implemented a shift-click for easy bulk selection of rows, and again if the total number of rows would exceed the limit we notify the user that the last addition to the selection will not be accepted.
This is the snippet for the first part:

  SelectAllCheckBoxVisibility v = (count > MAX_SELECTED_ITEMS_SIZE || count == 0)?
     SelectAllCheckBoxVisibility.HIDDEN : SelectAllCheckBoxVisibility.VISIBLE;
  MultiSelectionModel ms = (MultiSelectionModel)grid.getSelectionModel();
  if (v != ms.getSelectAllCheckBoxVisibility()) {
    ...
     ui.access(() -> ms.setSelectAllCheckBoxVisibility(v));
...

Reuben D Sivan:
Just for letting others know what I did based on the advice above: upon loading the count query from my lazy-loaded grid, I check if it is over a certain limit (500 rows, but might change it), and depepnding on the value I enable or disable the Select All box.
Furthermore, we implemented a shift-click for easy bulk selection of rows, and again if the total number of rows would exceed the limit we notify the user that the last addition to the selection will not be accepted.
This is the snippet for the first part:

SelectAllCheckBoxVisibility v = (count > MAX_SELECTED_ITEMS_SIZE || count == 0)?
     SelectAllCheckBoxVisibility.HIDDEN : SelectAllCheckBoxVisibility.VISIBLE;
  MultiSelectionModel ms = (MultiSelectionModel)grid.getSelectionModel();
  if (v != ms.getSelectAllCheckBoxVisibility()) {
    ...
     ui.access(() -> ms.setSelectAllCheckBoxVisibility(v));
...

Interesting Ruben,

can you share how you coded the shift click selection ?

Thanks

The code has some state but you should be able to figure out the missing parts based on this snippet:

                        if (lastSelectedItem != null && lastSelectedItem.getRowIndex() != event.getItem().getRowIndex()) {
                            int lastIndex = lastSelectedItem.getRowIndex();
                            int[] indexes = new int[]
 { lastIndex, event.getItem().getRowIndex() };
                            Arrays.sort(indexes);
                            int count = indexes[1]
 - indexes[0]
 + 1;
                            if (count + grid.getSelectedItems().size() > MAX_SELECTED_ITEMS_SIZE) {
                                Notifier.showNotification("Selection too large - max: " + MAX_SELECTED_ITEMS_SIZE);
                            } else {
                                assert lastQuery != null;
                                grid.asMultiSelect().select(fetchRowsByIndices(indexes[0]
, count).toArray(new SmartTableRow[0]
));
                            }
                        } else {
                            lastSelectedItem = event.getItem();
                            grid.select(event.getItem());
                        }