Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Aug 05, 2008 14:12
open dhtmlx forum
Move Rows

Iam trying to use the following function to move multiple selected rows up or down in the grid but its not working. What am I doing wrong?

function MoveRows()
{
var ids = mygrid.getSelectedId().split(',');
for(var i=0;i<ids.length;i++)
{
mygrid.moveRow(ids[i],"up");
}
}
Answer posted by Support on Aug 06, 2008 02:12
The code which you are using is correct, but result may differ based on selected order ( getSelectedId returns IDs in same order as they way selected )

If you have rows as

row 1
row 2
row 3

and selected rows are row3 and row2, the logic of your code will move row3 

row 1
row 3
row 2

and row2

row 1
row 2
row 3

as result we have the same view, but rows was moved