Hi,
I am having problem in moving rows in webgrid either up or down. The error seem to be appear when I try to swap the position of the last 2 rows. The javascript error message is 'Node' is null or not an object. My Javascript code as below. Would be glad if someone can help me on this. Thanks.
function MoveRow(gridName,direction) { var oGrid = igtbl_getGridById(gridName); var selectedRow = oGrid.getActiveRow();
if(direction=="up" && selectedRow.getIndex()>0) { try { var toPosition = selectedRow.getIndex()-1; oGrid.Rows.remove(selectedRow.getIndex()); oGrid.Rows.insert(selectedRow,toPosition); } catch(e) { alert(e.message); return; } } else if(direction=="down" && (selectedRow.getIndex()+1)< oGrid.Rows.length) { try { var toPosition = selectedRow.getIndex()+1; oGrid.Rows.remove(selectedRow.getIndex()); oGrid.Rows.insert(selectedRow,toPosition); } catch(e) { alert(e.message); return; } } return true; }
Thanks for asking the question, helped me!