JQgrid数据属性在包含数据的网格上返回[] [英] JQgrid data property returns [] on a grid with data

查看:103
本文介绍了JQgrid数据属性在包含数据的网格上返回[]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试时:

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

在具有24个元素的网格上,数据没有任何内容.

您知道在什么情况下会发生这种情况吗?

(与 JQGrid:从不同页面获取元素相关)

解决方案

padameter data保存网格的 local 数据.如果您使用不带loadonce: true选项的远程源(datatype: "json"datatype: "xml"),它将不会被填充(保留为空数组).如果jqGrid只是用从服务器返回的数据的页面填充网格(HTML表).如果服务器仅保留数据,则它负责数据的排序,分页和筛选/搜索.

如果您没有大型数据集(少于一百万或少于10000行),则通常可以通过使用loadonce: true选项获得更好的性能.在这种情况下,服务器可以只返回包含所有项的排序数据. jqGrid将显示此类数据的首页,并将在data_index参数中保存从服务器返回的所有数据.第一次加载jqGrid将datatype更改为"local"之后,所有以后的数据排序,分页和搜索/过滤将在不与服务器进行任何通信的情况下完成.

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)

解决方案

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.

这篇关于JQgrid数据属性在包含数据的网格上返回[]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆