I'm fighting with jqgrid about 8 days(or more), I have done everything excepting a small isuue. I have a big database and I'm trying to show it by portions. What I mean is that the sql query is executed every time when next
, prev
, last
, first
or when the user enters a page number. I have managed it and everything is correct, but now the grid is not showing the correct last page. What I mean is that even when there are 42 pages it's showing 1 of 1.
Now when I enter the page number the grid is refreshing and showing the correct results, but the pager is saying 2 of 1, 5 of 1 and so on.
What I have used is:
jQuery("#list").jqGrid({
datatype: "jsonstring",
datastr: JSON.stringify(gridDtls),
jsonReader:{
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false,
id: "0"
},
The code I'm using to run the query every time when a button is clicked is here(Note the below code is working only when enter is pressed as the buttons are inactive):
onPaging: function(pgButton){
var status = returnUserStatus();
var page1 = $(this).jqGrid("getGridParam", "page");
var totalPages = $(this).getGridParam('lastpage');
if(pgButton=="next_pager"){
}
if(pgButton=="prev_pager"){
}
if(pgButton=="last_pager"){
}
if(pgButton=="first_pager"){
}else if((pgButton !="first_pager") && (pgButton !="last_pager") && (pgButton !="prev_pager") && (pgButton !="next_pager"))
},
Everything seems correct to me. Why jqgrid is not returning the correct pages?I'm sure that I'm missing somthing small. Please help me!!!