PDA

View Full Version : What's the right way to exclude rows from being selectable



Jimse
21 May 2010, 11:45 AM
Hi, (first post since I started using GXT yesterday -- it's awesome!)

Is there a way to exclude rows in a Grid from being selectable when using the CheckBoxSelectionModel? Ideally, the grid would not allow selection of certain (I'll call them 'protected') rows (based on criteria in the ModelData) and not show a check box (when using CheckBoxSelectionModel).

I've kind of hacked around this by calling addSelectionChangedListener to my CheckBoxSelectionModel, and deselecting the protected rows. And also by setting a cell renderer on the CheckBoxSelectionModel's ColumnConfig wherein I return an empty string for rendering the protected rows.

The hack breaks the functionality of the header checkbox though, since its state is calculated by comparing the current selection size with the grid's store size.

I can subclass CheckBoxSelectionModel to fix this final problem, but wanted to know if there's a more sane way.

Thanks.