I am using GWT 2.4 version. How to disable row selection in GWT Datagrid.
In my Grid i have mixed records, But based on the condition i need to disable the row selection in DataGrid.
For Example : I have 2 rows with below values
EMP Name| EMP ID | Status
ABC | 1001 | Active
ABC | 1001 | In Active
When user click on 2nd row it should not be selected.
How to achieve this. Please let me know.
I was able to achieve this with default checkbox selection event manager.
By default you would have a
CheckboxCellthat would handle row selection. The trick is that you can override therender()method of theCheckboxCelland do not render the checkbox if corresponding row is not allowed to be selected by simply not callingsuper.render()method.Below is a full working code for your example. You can not select rows that are not active. Please, notice the parameters of the constructor
new CheckboxCell(true, false)- this is important.I just had to add an unique row identifier as a selection id.
After each selection change you will see an alert with a list of selected row ids.