JQuery and JqGrid retrieve data from row(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?
推荐答案
可以通过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');
(这里我假设您的 jqGrid 的 <table>
元素具有 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 从行中检索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:JQuery 和 JqGrid 从行中检索数据


基础教程推荐
- 如何使用TypeScrip将固定承诺数组中的项设置为可选 2022-01-01
- 我可以在浏览器中与Babel一起使用ES模块,而不捆绑我的代码吗? 2022-01-01
- 自定义 XMLHttpRequest.prototype.open 2022-01-01
- Vue 3 – <过渡>渲染不能动画的非元素根节点 2022-01-01
- 如何使用JIT在顺风css中使用布局变体? 2022-01-01
- 直接将值设置为滑块 2022-01-01
- html表格如何通过更改悬停边框来突出显示列? 2022-01-01
- Electron 将 Node.js 和 Chromium 上下文结合起来意味着 2022-01-01
- Chart.js 在线性图表上拖动点 2022-01-01
- 用于 Twitter 小部件宽度的 HTML/CSS 2022-01-01