as far as i know there is no solution for that in jquery and you have to do it yourself . below i have working code for the pager :
function jqgridCreatePager(pagernav,navgrid,pages){
$('#'+pagernav+' #'+pagernav+'_center td:has(input)').attr('id','pager');
var td = $('#'+pagernav+' #'+pagernav+'_center #pager').html('');
var page = parseInt(jQuery("#"+navgrid).jqGrid('getGridParam','page'))
var lastPage = parseInt(jQuery("#"+navgrid).jqGrid('getGridParam','lastpage'))
text='';
if(page-pages > 1){
text+=jqgridCreatePageLink(navgrid,1)
text+= ' ... '
}
for(var i=0;i <pages;i++){
if(page-pages+i >=1)
text+=jqgridCreatePageLink(navgrid,page-pages+i)
}
text +=jqgridCreatePageLink(navgrid,page,true);
for(var i=0;i <pages;i++){
if(page+i+1 <= lastPage)
text +=jqgridCreatePageLink(navgrid,page+i+1)
}
if(page+pages <= lastPage){
text+= ' ... '
text+=jqgridCreatePageLink(navgrid,lastPage)
}
var td = $('#'+pagernav+' #'+pagernav+'_center #pager').html(text);
}
and function which is making links
function jqgridCreatePageLink(navgrid,page,current){
if (!current)
return ' <a href="#" onclick="jQuery(\'#'+navgrid+'\').jqGrid(\'setGridParam\',{page:'+page+'}).trigger(\'reloadGrid\')">'+page+'</a> ';
return ' >'+page+'< '
}
now to integrate this code with grid just add it when grid is created gridComplete event or something like that:
//create
jqgridCreatePager('yourGridNavigator','yourGrid',3)
and also attach it to onPage event
//onPage
jqgridCreatePager('yourGridNavigator','yourGrid',3)
to prevent flickering just add to your css
#yourGridNavigator_center{
display:none;
}
and again on gridComplete just add
$('#yourGridNavigator_center').show();
as to the function patrameters:
- first is your grid navigator id
- second is your grid id
- this third parameter of the function is how many pages should be displayed before and after current page