A customer wants to add a checkbox column to select the rows. I would like to achieve this on the client side. I already set up the behavior for selecting rows and this works fine.
Where i am struggling is the following:
I created a templateDataField and added the following control:
<input type="checkbox" name="selectedCheckBox" value="0" onclick="SelectedCheckBox(this)" />
Now i want to know what row the control is residing in and select this row if the checkbox is checked.
How would I go about doing this?
Maybe a better question might be: how do I keep the checkbox synchronized with the selected rows?
Actually client or serverside does not matter...
Hi djmartain,
To keep the rows syncronized, you will have to use a lot of custom code. The best place to keep it syncronized would probably be the client since selection does not automatically go back to the server. You'd need to handle row selection changed and then go through the rows, find the checkbox in the cell and check it. To go the other way is slightly more difficult. You would need to handle mouse click on the checkbox and then use grid._gridUtil to find the cell and then row. Then select it off of the selection behavior. Try grid._gridUtil.getRowFromCellElem(elem) to get the row. The elem would be the checkbox element that was clicked. Another option if you have 11.1 is to use an UnboundCheckBoxField. You would just have to set the value of the checkbox cell to true/false for it to display checked/unchedcked. You would follow the same sort of custom logic, though.
regards,David Young