从jqGrid中检索行数据

时间:2013-07-09 07:03:06

标签: jquery jqgrid jqgrid-asp.net

    var rowdata;
        var records = $("#tblWorkGroupDetails").getGridParam("reccount");
        for (var i = 0; i < records; i++) {
            var index = i;
            var rowId = jQuery('#tblWorkGroupDetails tr:eq(' + index + ')').attr('id');
            rowdata = $('#tblWorkGroupDetails').getCell(rowId, 'groupname') + "," + $('#tblWorkGroupDetails').getCell(rowId, 'workcode');
        }

将rowdata视为'false,false'。任何人吗?

2 个答案:

答案 0 :(得分:0)

.length用于records

for (var i = 0; i < records.length; i++) {
    var index = i;
    var rowId = jQuery('#tblWorkGroupDetails tr:eq(' + index + ')').attr('id');
    rowdata = $('#tblWorkGroupDetails').getCell(rowId, 'groupname') + "," + $('#tblWorkGroupDetails').getCell(rowId, 'workcode');
}

此外,检查rowId中的值。

答案 1 :(得分:0)

var rowData = $("#tblWorkGroupDetails").jqGrid('getRowData', rowId);

    to access each column value say,
    rowData.name