获取jqGrid中的所有行ID [英] Get all row IDs in jqGrid

查看:513
本文介绍了获取jqGrid中的所有行ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取网格中每一行的ID,即使是跨页面的ID也是如此?

How can one get the ID's of every row in a grid, even across pages?

getDataIDsgetRowData仅给出当前页面的ID.

getDataIDs and getRowData only gives the ID's of the current page.

谢谢!

推荐答案

仅当您具有本地网格(datatype:'local'loadonce:true)时,才有可能.在这种情况下,所有页面的所有包含数据的ID都已经在本地.在这种情况下,您可以使用_index参数,该参数通常会与另一个更知名的参数data一起使用.与

It is possible only if you have local grid (datatype:'local' or having loadonce:true). In the case all data inclusive ids for all pages are already locally. In the case you can use _index parameter, which will be used typically together with another more known parameter data. With

var idToDataIndex = $("#list").jqGrid('getGridParam','_index');

您将获得_index参数.它是一个具有grid的所有id作为属性的对象.因此,您可以使用

you will get the _index parameter. It is an object which has as the properties all ids of grid. So you can enumerate the ids with

var id;
for (id in idToDataIndex) {
    if (idToDataIndex.hasOwnProperty(id)) {
        // id is the rowid.
        // to get the data you can use
        // mydata[idToDataIndex[id]] where
        // var mydata = $("#list").jqGrid('getGridParam','data');
    }
}

这篇关于获取jqGrid中的所有行ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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