Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Grid SelectionMode=Single, toggling effect, how to stop?
I click on a new row, it comes the selected row. Fine. If I click on the same row, it becomes visually deselcted.
Anyway to turn this off? If I click on a selected row, I want it to remain selected.
e.g. http://demo.vaadin.com/sampler/#ui/grids-and-trees/grid/features
The Table does this when in SelectionMode=Multi, but grid I don't want multiple selection on grid, and don't want the selection checkbox either.
Thanks.
Hi Dino,
You can achieve this with SelectionModel. If grid set as "SelectionMode.SINGLE", an instance of SingleSelectionModel (extend SelectionModel) is created. This class has a method "setDeselectAllowed". Below example of code:
((SingleSelectionModel) grid.getSelectionModel()).setDeselectAllowed(false);
Fred
Brilliant, that is exactly what I wanted.
In Scaladin its
selectionMode=SelectionMode.Single
val single=selectionModel.asInstanceOf[Grid.SelectionModel.Single]
single.deselectAllowed=false
Thanks.