Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Steve on Jun 09, 2008 10:16
open dhtmlx forum
Row Selection

The following method you posted worked for selecting. However, mygrid.attachEvent("onRowSelect",doOnRowSelected); does not fire when using the code. Is there a way to manually make it work?


There are no special commands for such task , but it can be done as

var current = grid.getSelectedId();
if (!current) return;

//select next
grid.selectRow(grid.getRowIndex(current)+1);

//select previous
grid.selectRow(grid.getRowIndex(current)-1);

Answer posted by Support on Jun 10, 2008 03:21
By default - onRowSelect event initiated only when selection changed, it not occurs for API calls.
You can call any event manually, by using grid.callEvent(..., but in case of row selection there is a more simple way - just set second parameter of command as true

//select next
grid.selectRow(grid.getRowIndex(current)+1,true);

With second parameter set as true, selectRow command will fire onRowSelect event