Multi Select Grid - disable some checkbox

It’s possible to disable the checkbox from some rows in a grid, for sample if the id are odd?

You cannot actually disable it selectively, but you can go pretty close with help of CSS.

Say if you have item.getValue() returns boolean, so set style generator to set some style on row if true

setStyleGenerator(item -> { return item.getValue() ? "selection-checkbox-disabled" : null;});

Then put something like this to your theme, which will disable pointer events in first td of that row, which happens to be the selection column. You probably want to style the color or something too, so that user has visual que it is disabled

.v-grid-row.selection-checkbox-disabled {
	td:first-child {
		pointer-events: none;
	}		
}

And I forgot to mention, the above does not prevent selection by space bar, so you need to add some code for that too, like:

addSelectionListener(event -> {
    if (event.getFirstSelectedItem().isPresent()) if (event.getFirstSelectedItem().get().getValue()) {
	    this.deselect(event.getFirstSelectedItem().get());
	    return;
    }
	...
}

Is there by chance any way in Vaadin 14 to disable or even hide the row-selection checkbox for specific rows?