PDA

View Full Version : Editor Grid and Row selection



steevebd
11 Mar 2011, 1:51 AM
Hi,

I would like to know the best way to get row selection on an editor grid with checkboxes.

Thanks and regards,

Steeve

blay
11 Mar 2011, 2:05 AM
Create a CheckBoxSelectionModel and add it to the column configuration of your grid. Then set the SelectionMode for the checkBoxSelectionModel; set the grid to use it, and add it as a plugin.

For example:



CheckBoxSelectionModel<YourModelData> cbSm = new CheckBoxSelectionModel<YourModelData>();
cbSm.setSelectionMode(SelectionMode.MULTI);

...

List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
columns.add(cbSm.getColumn());

...

grid.setSelectionModel(cbSm);
grid.addPlugin(cbSm);

steevebd
30 Mar 2011, 1:24 AM
Hi,

I managed to get everything working the way i wanted to thanks to the code you gave, but now i have a strange behavior between IE and Firefox.
I defined one column to be editable with a CellEditor of a NumberField. While this is working properly in IE, it seems that i get null in postProcessValue method of the NumberField instance i used in my editor.
Is it a misunderstanding on the way i wrote it? Is it a bug linked to my version (2.2.0)?

Thanks and regards,

Steeve