I have a problem with adding a new empty row in a jqgrid.
My colmodel is :
colModel: [{ name: \'recid\', index: \'testid\', hidden: true, editable: true,
try instead of that
var newRowData = [{ "recid": rowid, "JobTask.Id": "@(Model.id)", "InvolvedParty.Id": "", "InvolvedParty.Lastname": "", "deletefield": ""}];
doing :
var newRowData = { "recid": rowid, "JobTask.Id": "@(Model.id)", "InvolvedParty.Id": "", "InvolvedParty.Lastname": "", "deletefield": ""};
if this won't work , make sure that added rows for sure have different ids
you can also try reloading after adding new row by trigger(“reloadGrid”)
hope that will help i have no more ideas
EDIT :
ok i now what was wrong
from jqgrid wiki :
... This method can insert multiple rows at once. In this case the data parameter should be array defined as [{name1:value1,name2: value2…}, {name1:value1,name2: value2…} ] and the first option rowid should contain the name from data object which should act as id of the row. It is not necessary that the name of the rowid in this case should be a part from colModel.
that meens you should be able also to use [] like that :
var newRowData = [{ "recid": rowid, "JobTask.Id": "@(Model.id)", "InvolvedParty.Id": "", "InvolvedParty.Lastname": "", "deletefield": ""}];
$("#grid_id").addRowData("recid", newRowData);