Cell Rows and Selectable Table Cells

I have a GWT 2.4 DataGrid related to SingleSelectionModel. One of the columns in the grid is CheckboxCell, but it is not used to select, but to set the value of the Boolean field for the base type of the row element. My problem is that when I click on this checkbox, the row is selected first, then I have to click a second time to check / uncheck the box. I would prefer that clicking outside the checkbox makes a row selection, while clicking on a checkbox only sets / unchecks this checkbox. Can someone point me in the right direction how to do this. I keep returning to onBrowserEvent, but I'm not sure what to try.

+6
source share
2 answers

There are several approaches you can do, depending on what exactly you want to do. Here are two ideas that come to mind:

+6
source

This code solved in my case a problem very similar to yours.

 Column<SomeBean, Boolean> checkboxColumn= new Column<SomeBean, Boolean>(new CheckboxCell(true,false)) { @Override public Boolean getValue(SomeBean object) { if(object == null || object.getId() == null) return null; return selectionModel.isSelected(object); } }; 
0
source

Source: https://habr.com/ru/post/900814/


All Articles