Get all rows data of a JQGrid in codebehind?

Mohammad Dayyan picture Mohammad Dayyan · Mar 17, 2012 · Viewed 18.5k times · Source

I'm adding some rows data to my JQGrid on client side with 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 rows data (in JQGrid) in code-behind?

Answer

Oleg picture Oleg · Mar 17, 2012

You can get all rows from the grid by

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

or with respect of

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

The last way can be used only with local datatype or in case of loadonce: true. It returns data not only from the current page, but all data from all pages.

The getRowData method use unformatter to read the data from all cells of the grid.