JQgrid data property returns [] on a grid with data

只谈情不闲聊 提交于 2019-12-25 05:13:40

问题


When I try:

$(MyGrid).jqGrid('getGridParam');

On a grid with 24 elements, data has nothing.

Do you know under which conditions this might happen?

(related with JQGrid: Get elements from different pages)


回答1:


The padameter data hold local data of the grid. It will be not filled (stay empty array) if you use remote source (datatype: "json" or datatype: "xml") without loadonce: true option. In the case jqGrid just fill the grid (HTML table) with the page of data returned from the server. In the case the server hold the data only and it is responsible for sorting, paging and filtering/searching of data.

If you have not a large dataset (less as a million or less as 10000 rows) then one have better performance typically by usage of loadonce: true option. In the case the server can just return sorted data with all items. jqGrid will display the first page of such data and will hold all data returned from the server in data and _index parameters. After the first loading jqGrid changes datatype to "local" and all later sorting, paging and searching/filtering of the data will be done without any communication with the server.



来源:https://stackoverflow.com/questions/24954922/jqgrid-data-property-returns-on-a-grid-with-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!