Get all JQGrid row data in code?

I am adding some row data to JQGrid client side using javascript:

var grid = jQuery("#<%= JQGridMembers.ClientID %>");
var rowKey = grid.getGridParam("selrow");
var newRow = [{ ID: memberId, FullName: memberFullName, Percent: parseInt(percent)}];
grid.addRowData(memberId, newRow);


above code works well, but how can I get all inserted row data (in JQGrid) in code-behind?


source to share

2 answers

You can get all rows from the grid

var myData = grid.jqGrid('getRowData');


or relatively

var myData = grid.jqGrid('getGridParam', 'data');


The latter method can only be used with local datatype

or in case loadonce: true

. It returns data not only from the current page, but all data from all pages.

The method getRowData

uses unformatter to read data from all cells in the grid.



If there was a similar problem, below I figured out I was using

var data = $("#table-id").jqGrid('getGridParam', 'data');
for (var i = 0; i < data.length; i++) {
    var f_name = data[i].FirstName;
    var l_name = data[i].LastName;
    // blah... blah..





All Articles