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.