JqGrid: How to get all column values ​​from onCellSelect event?

I am developing an ASP.NET mvc project that uses JqGrid to generate a report. To generate reports, I generate 2 different reports. A second report will be created based on the values ​​of the first report. To get the column values, I use the OnCellSelect event for JqGrid,

Event:

$('#Report1').jqGrid({
...
..
colNames: ['name1','name2','name3','name4','name5','name6','name7'],
                        colModel: [
                        {....},
                        { ... },
                        { ...},
                        {...},
                        { ...},
                        { ...},
                        { ... }
                    ],
                        jsonReader: {
                            root: 'DD_data',
                            id: 'name1',
                            repeatitems: false
                        },
                        pager: $('#pager'),
//Event fires when clicked on name7
onCellSelect: function (rowid, index, contents, event) {   

//Code for generating Second Report based on First report data//
$('#Report2').jqGrid({
...
...
});
} 
});

Here, in the Cell Select event, I get only the rowid code, my key and selected cell.

But I also need names2, name3 and name4 from the selected column to create a second report.

Is this possible in JqGrid.

Any help is appreciated.

+4
source share
1 answer

getCell getRowData, rowid. datatype: "local" loadonce: true #Report1, getLocalRow, getRowData, , data. , datatype "json" "xml", "json" "xml", loadonce: true.

, ,

onCellSelect: function (rowid) {
    var rowData = $(this).jqGrid("getRowData", rowid);
    // now you can use rowData.name2, rowData.name3, rowData.name4 ,...
}

getLocalRow ( ), , datatype loadonce, #Report1.

+8

All Articles