user590586
user590586

Reputation: 3050

jqGrid change row values

How can I change data already present in my grid's row with different data on click of a button? I want to update the values of selected row with new values.

Upvotes: 0

Views: 7336

Answers (1)

Oleg
Oleg

Reputation: 221997

The code could look like

var myGrid = $("#list");
var selRowId = myGrid.jqGrid('getGridParam','selrow');
myGrid.jqGrid('setRowData',selRowId,newData);

where the newData in the object of data that contain the new values. The structure of array is in type name:value (for example {firstName:"foo", lastName:"bar"}). You can examine the current data from the row with

var oldData = myGrid.jqGrid('getRowData',selRowId);

Upvotes: 4

Related Questions