How to get a jqGrid selected row cells value

后端 未结 6 655
忘掉有多难
忘掉有多难 2020-12-08 13:40

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 ?<

6条回答
  •  误落风尘
    2020-12-08 14:18

    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');
    

    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.

提交回复
热议问题