Search code examples
jsonjqgrid

JqGrid triand addJSONData add max 20 rows


I am changing from addrowdata to addjsondata for getting e better performance in grids with more than 20 rows the problem that addjsondata is given is that if I pass an array of rowdata more than 20 rows it adds only the first 20 rows.

version in use is 4.4.5


Solution

  • I recommend you to use either toppager: true or pager parameter to display the pager. jqGrid always makes paging. Default value of rowNum parameter is 20 (see "Default" column in the table here). So jqGrid displays the first page (20 rows) even is the user don't see any pager which allows him to change the page.

    So you should use rowNum parameter with some large enough value (like rowNum: 10000) or use toppager or pager parameter parameter (or both) to display the pager which allows the user to change the page.

    Finally I would recommend you to use data parameter with datatype: "local" to create the grid together with the data instead of usage addRowData or addJSONData. In the way you will fill the data and display the first page of sorted data. Don't forget to include gridview: true in the list of the options which you use (see the answer). If you need to refill (replace) the data of the local grid you can use clearGridData, set new value of data parameter using setGridParam and finally calls .trigger("reloadGrid") to reload the grid.