Here is my code that adds a line to the grid by pressing the enter key.
All lines are in the add mode editrow=true.
jQuery("#energy").jqGrid('addRow', { position: "first" });
jQuery("#energy").jqGrid('bindKeys', {
"onEnter": function (rowid) {
jQuery("#energy").jqGrid('addRow');
}
});
What you need to specify that prametr editrow=false, when adding rows?
Unfortunately it seems that the code for
addRowalways sets the new row to edit mode:But the good news is that, you should be able to use
saveRowto get the row out of edit mode. Just make sure you pass a unique row ID for the new row so that you are able to reference it in the next call:If you have problems with
saveRow, you can also tryrestoreRow.Does that help?