Grid in MultiSelect mode: Is there a way to disable the checkbox based on r

Hi All,

I have a grid that allows multiple selections. I’d like to disable the selection of some rows by disabling the checkbox. Is there an easy way to do this?

Thanks in advance for your help.

Hi Rebecca,

Using the latest vaadin alpha version (currently 7.6.0.alpha5) you can actually extend and modify the existing SelectionModel implementations. You can override the client-side to provide a renderer that is aware of the data and can prevent some rows from being selected, but this is actually pretty tricky to actually implement.

First of all you need to make a named override of the server-side part of the SelectionModel. For example

public class MySelectionModel extends MultiSelectionModel ..

that overrides the method
to write a boolean telling if this row can be selected to the actual row data.

Then you neeed a corresponding client-side connector

@Connect(MySelectionModel.class) public MySelectionModelConnector extends MultiSelectionModelConnector In this connector you need to override the method
and use you own implemention (most likely extends the client-side implementation of
from the
) and in that implementation you need to provide a customized version of
that disables the checkboxes when needed.

This is the basic idea on extending a selection model starting from Vaadin 7.6.0.alpha5. Before that, you need more client-side hacks to provide the similar functionality.


Thanks Teemu. We are still on 7.4.7. Will give this a try when we have a chance to upgrade.