JQGrid:从不同页面获取元素 [英] JQGrid: Get elements from different pages

查看:161
本文介绍了JQGrid:从不同页面获取元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个JQGrid,其中包含24个元素,每页10个元素.

I have a JQGrid with 24 elements, 10 elements by page.

运行以下行时,位于第三页:

When I run the following line, being on the 3rd page:

var idList = $(MyList).getDataIDs();

我只能从第三页获得4个元素.

I can only get the 4 elements from the 3rd page.

如何从整个列表中获取元素?

How can I get the elements from the whole list?

我尝试过:

$(MyList).jqGrid('getGridParam','data');

但是我得到了

[]

(与有关,JQgrid数据属性在包含数据的网格)

推荐答案

是您datatype: "local"还是将远程数据源(datatype: "json"datatype: "xml")与loadonce: true一起使用然后将填充data_index参数.选项data是项目数组.选项_index是一个对象,其属性是已加载数据的id值.您可以使用for循环遍历所有id.请参见答案旧版本一个以获取更多信息.在某些情况下,使用getLocalRow方法通过id访问data数组中的项目是很实际的.

It you datatype: "local" or if you use remote data source (datatype: "json" or datatype: "xml") together with loadonce: true then data and _index parameters will be filled. The option data is array of items. The option _index is an object which properties are id values of the loaded data. You can use for loop to iterate over all ids. See the answer or this old one for more information. In some scenarios it would be practical to use getLocalRow method to access items from data array by id.

这篇关于JQGrid:从不同页面获取元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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