Here's how to navigate rows in jqGrid (jQuery Grid)
function naviGrid(direct)
{
var gridArr = $('#list1').getDataIDs();
var selrow = $('#list1').getGridParam("selrow");
var curr_index = 0;
for(var i = 0; i < gridArr.length; i++)
{
if(gridArr[i]==selrow)
curr_index = i;
}
if(direct == 'back') //back
{
if((curr_index-1)>=0)
$('#list1').resetSelection().setSelection(gridArr[curr_index-1],true);
}
if(direct == 'fwd') //forward
{
if((curr_index+1)<gridArr.length)
$('#list1').resetSelection().setSelection(gridArr[curr_index+1],true);
}
}
No comments:
Post a Comment