如何获取 jqGrid 选定的行单元格值 [英] How to get a jqGrid selected row cells value

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

问题描述

有谁知道如何获取 JQGrid 选定行的单元格值?我正在使用带有 JQGrid 的 mvc,我想访问所选行的隐藏列的值?

Does anyone know how to get the cells value of the selected row of JQGrid ? i m using mvc with JQGrid, i want to access the value of the hidden column of the selected row ?

推荐答案

首先可以通过getGridParam方法和rowid="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options" rel="noreferrer">'selrow' 作为参数,然后你可以使用 getCell 从相应列中获取单元格值:

First you can get the rowid of the selected row with respect of getGridParam method and 'selrow' as the parameter and then you can use getCell to get the cell value from the corresponding column:

var myGrid = $('#list'),
    selRowId = myGrid.jqGrid ('getGridParam', 'selrow'),
    celValue = myGrid.jqGrid ('getCell', selRowId, 'columnName');

'columnName' 应该与您在 colModel'name' 属性中使用的名称相同.如果您需要所选行的多列中的值,您可以使用 getRowData 而不是 getCell.

The 'columnName' should be the same name which you use in the 'name' property of the colModel. If you need values from many column of the selected row you can use getRowData instead of getCell.

这篇关于如何获取 jqGrid 选定的行单元格值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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