JQuery和JqGrid从行检索数据 [英] JQuery and JqGrid retrieve data from row

查看:114
本文介绍了JQuery和JqGrid从行检索数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我只有行的编号,如何从jqgrid行检索数据?

How I can retrieve data from jqgrid row, if I have only the number of the row?

例如,如果我想要的话,我该怎么办?第3行的id列?

For example, what do I have to do if I want the id column of the 3rd row?

推荐答案

您可以按行ID获取数据。所以你可以这样做:

You can get the data by row id. So you can do following:

var index = 2; // zero-based index of row so it means the 3rd row
var rowId = jQuery('#list tr:eq('+index+')').attr('id');

(这里我认为< table> jqGrid的元素有id =list)。在您知道行的ID后,您可以获得与相关的行数据getRowData 方法或从一个小区仅相对于的数据 getCell 。方法:

(here I suppose that the <table> element of your jqGrid has id="list"). After you know the id of the row you can get the row data with respect of getRowData method or the data from one cell only with respect of getCell method:

var dataFromTheRow = jQuery('#list').jqGrid ('getRowData', rowId);
var dataFromCellByColumnIndex = jQuery('#list').jqGrid ('getCell', rowId, 7);
var dataFromCellByColumnName = jQuery('#list').jqGrid ('getCell', rowId, 'Tax');

这篇关于JQuery和JqGrid从行检索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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