JQgrid:所选行中的特定值 [英] JQgrid : specific value from a selected row
问题描述
如何从所选行中获取(隐藏)列的值.也就是说,单元格值必须来自colName标识的单元格和所选行(不使用多重选择).从API中,我看到了用于读取行的getGridParam("selrow")方法,可以与其他方法结合使用..但是,有没有方便的方法?一个代码片段将节省大量时间... \ 谢谢.
how to get a value of a (hidden) column, from the selected row. that is, the cell value needs to be from the cell identied by colName, and the selected row (not using multi select). From the API i see the method getGridParam("selrow") for reading the row, may be able to combine with other methods.. but, any convenient method available? a code snippet would save lot of time... \ thanks.
推荐答案
您应该使用getCell
函数从行ID标识的单元格中读取值.因此,如果您需要所选行的"MyColName"列中的数据,则可以使用以下代码进行操作:
You should use getCell
function to read the value from the cell identified by row id. So if you need a data from the column 'MyColName' of selected row you can do this with the following code:
var grid = jQuery('#list');
var sel_id = grid.jqGrid('getGridParam', 'selrow');
var myCellData = grid.jqGrid('getCell', sel_id, 'MyColName');
如果需要读取一行的完整数据,则可以使用getRowData
代替getCell
.您可以在文档中阅读有关jqGrid支持的方法的更多信息(请参阅 http://www.trirand.com/jqgridwiki/doku.php?id=wiki:方法).
If you need read full data of a row you can use getRowData
instead of getCell
. More about methods supported by jqGrid you can read in the documentation (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods).
这篇关于JQgrid:所选行中的特定值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!