Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Andrew on Mar 26, 2008 09:13
open dhtmlx forum
How to select the row when a checkbox is selected

If a user (un)selects a checkbox on my grid the row that is selected doesn't change. This behavior is the same when clicking on a link.
Here is an example:

row1 delete checkBox

row2 delete checkBox <-- currently selected

row3 delete checkBox

If a user went and clicked the delete link on row one the grid thinks it is dealing with the selected row (row 2).

Also if I were to select the checkBox on row3 the grid thinks it is row two.

Is there a way to set the row as soon as a cell elemented is selected?

Thanks,

andrew
Answer posted by Support on Mar 26, 2008 11:17
If you are using inline javascript, then order of processing will be

a) inline javascript in cell
b) global event handler of grid

So the selection event will occur only after inner javascript event processed

>>Also if I were to select the checkBox on row3 the grid thinks it is row two
In case of checkbox ( column type ch ), you can receive ID of current row directly from event, without using getSelectedRow

grid.attachEvent("onCheckbox",function(id,index,state){
     //any custom code here
    // id - ID of row for which checkbox state changed
    return true;
});