Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pagination not working for the json in JqGrid

My pagination is not working when I removed the loadonce:true ...but if I use loadonce:true than my grid is not working. Any idea how can I get my pagination work again.

update: this is extension to problem loading data in details jqGrid from master grid?

like image 982
paul Avatar asked Dec 21 '22 23:12

paul


1 Answers

If you remove loadonce:true and use datatype:"json" or "datatype:xml" jqGrid option then your server must implement pagination. The server receive some parameters which will be appended to the url in case of 'GET' requests or send in the HTTP body in case of "POST" requests. This parameters are rows, page, sidx, sord. For example if your table have a column with the index 'Name' as the current sort column and rowNum: 20 then your url will be appended with ?rows=20&page=1&sidx=Name&sord=asc. Your server should construct SELECT statement to the database where the data are placed with ORDER BY Name asc then divide the result in pages 20 rows per page and send back the first page of the results. (See Get current url including parameters of Jqgrid for a little more information). For a PHP with MySQL on the server see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:first_grid#php_and_mysql_example_file as an example.

So in case of loadonce:false or no loadonce parameter your server is responsible for sorting and paging of the data. If it is not work you should verify your server code.

like image 85
Oleg Avatar answered Jan 08 '23 03:01

Oleg