Reputation: 6178
I am working on jqgrid
I want to customize jqgrid pagination.
Suppose I have 100000 records which I need to load in the jqGrid but not all at once because it takes a lot of time. So, I want to load first 100 records at first load of page. And then I will load next 100 using ajax call while clicking next page and so on.
Any suggestion will be grateful
Upvotes: 1
Views: 1496
Reputation: 222017
The requirement can be easy implemented in jqGrid. By the way the requested functionality in the oldest way implemented in jqGrid.
jqGrid have url
option. jqGrid makes request to the URL which includes some additional parameters which default names are page
, rows
, sidx
, sord
. One can use prmNames
option to rename the parameter. It you for example create new grid with options: url: "MyUrl"
, datatype: "json"
, rowNum: 100
, sortname: "soomeMyColumnName"
then jqGrid will send HTTP GET request (if you don't use mtype: "POST"
additionally) which looks like MyUrl?page=1&rows=100&sidx=soomeMyColumnName&sord=asc
. The server should return first 100 items (or less) of data sorted by soomeMyColumnName
in JSON format described here. The response should inform jqGrid about the total number of pages and records additionally to the data itself. You should use either pager
or toppager: true
or both parameters to create pager/pagers in the grid which Fisrt/Previous/Next/Last buttons and the possibility to request page by direct page number. See the documentation and the old answer for more details.
Upvotes: 1