Forum
08:07
17/08/2010
I really appreciate and enjoy jqGrid and use it in some projects.But my customers are very strict about pager,they want to a pager style like "pre-ten 11,12,13,14,15,16,17,18,19,20 next-ten".
I find no method to extend jqGrid to support the pager style. Maybe I could use loadComplete event for customization ,just like
$(document).ready(function() {
$("#myTable").jqGrid({
datatype: 'json',
pager:"#pager",
…………….,
loadComplete:function(data) { var nav=$("#pager"+"_"+"left","#pager");
$("#dvCustomerPager",nav).remove();
var dvCustomerPager=$("<div id='dvCustomerPager' ></div>");
var curPage=parseInt($("#myTable").getGridParam("page"));
var itr;
for(var c=-4;c<6;c++)
{
itr=(curPage+c);
dvCustomerPager.append($("<a href='#' style='margin:0px 3px 0px 3px;' onclick='gotoPage("+itr+")'>"+itr+"</a>"));
}
nav.append(dvCustomerPager);
}
});
});
……………….
function gotoPage(thePage)
{
$("#myTable").setGridParam({page:thePage}).trigger("reloadGrid");
}
But I must copy these codes for every jqGrid instance .I want to find some methods to extend the $.fn or set $.jgrid.defaults.loadComplete so that it does effects for every jqGrid instance. So could you give a extention point to support customiztion pager. Or you may add another parameter that pass jqGrid instance itself in loadComplete event ,so that I can get the jqGrid instance and get its parameters. Or you may provide a afterPaging event and pass jqGrid instance to it , and then I could do something for customization pager.
In addition , I think a getNavBar() method that returns jgGrid instance's navigation bar(pager element) is neccessary.Because you may change navbar's id in the later version and my extension may lose efficacy .But if you provide getNavBar() , my extension will always work independent of any new version.
Thank you!
Most Users Ever Online: 715
Currently Online:
87 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66