Bala
Bala

Reputation: 1139

JQGrid server pagination not working

Client side pagination is working for me(that was very easy). I have a method in the server side that will accept pagenumber and number of records. When I display the grid for the first time, for example I get 15 records, I also set the pagenumber, totalpages. if I have 40 records, it should say "view 1-15 of 40", "page 1 of 3". I set the attributes like this.

$("#sampleGrid").jqGrid({
loadonce:false,
page: 1,
rowNum: 15,
TotalPages: 3,
onPaging: {
if(pgbutton == "next_gridpager"){
//call the server side method. pass pagenumber and number of records as parameter
}
else if(pgbutton == "prev_gridpager")
{
 //call server side method to get data
}
});

The problem is even though I specify the page to be displayed and Totalpages, it shows only first page. how do i tell jqgrid that it is not client side pagination and please set the totalpages to 3.

Upvotes: 0

Views: 229

Answers (1)

tazfather
tazfather

Reputation: 13

You provide too little information about your problem. What data you received from the server? It must look like:

{"total":3,"page":1,"records":40,"rows":[your data...]}.

You don't need to use parameter TotalPages and onPaging event in jqGrid config, if reply from server is correct, pagination will work, to enable server side pagination you need to set datatype and url parameter

Upvotes: 1

Related Questions