javascript jqGrid 如何遍历网格?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8492027/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 03:37:14  来源:igfitidea点击:

jqGrid how do you loop through the grid?

javascriptjqueryjquery-ui

提问by user957863

I have a project that uses jquery's jqgrid. How do I loop through the grid rows and get to a value?

我有一个使用 jquery 的 jqgrid 的项目。如何遍历网格行并获得一个值?

somethign like

类似的东西

var rows = $(#mygrid).rows
foreach(row in rows)
    alert(row["firstName"])

I have even seen something like this, but no examples of what to do with it.

我什至见过这样的事情,但没有例子说明如何处理它。

var rows = $('#grid').jqGrid('getCol','firstName');

回答by dllhell

try this:

试试这个:

var rows = jQuery("#grid").getDataIDs();
 for(a=0;a<rows.length;a++)
 {
    row=jQuery("#grid").getRowData(rows[a]);
    row.colname1; row.colname2; 

 }