Forum



10:45

08/03/2013

Dear Forum,
I'm having a problem with adding new rows using inline editing. Delete and edit are going fine.
When I add the first new row it goes OK. Data is posted to the server when I press the 'save row' button and the new row stays in the grid. However when I add a second new row, I can add the row and fill in the cells, but when I press the 'save row' button nothing happens, the data is not posted to the server. I use jqGrid 4.4.4, but I also tried with 4.4.3 and this gives the same result.
I've debugged the jquery.jqGrid.src.js (version 4.4.4) a bit and I think the problem is the following. The second time that I add a new row, in code line 9444 the rowID is set to 'jqg1', so the addClass("jqgrid-new-row") is applied to that row.
$($t).jqGrid('addRowData', p.rowID, p.initdata, p.position);
p.rowID = $t.p.idPrefix + p.rowID;
$("#"+$.jgrid.jqID(p.rowID), "#"+$.jgrid.jqID($t.p.id)).addClass("jqgrid-new-row");
However in the part of the code that handles the onClick of the 'save' button (line 9558), the rowID is set to 'jqg2'. This row does not have the class jqgrid-new-row, so the 'else' branche is taken.
if($("#"+$.jgrid.jqID(sr), "#"+gID ).hasClass("jqgrid-new-row")) {
o.editParams.extraparam[oper] = opers.addoper;
} else {
o.editParams.extraparam[oper] = opers.editoper;
}
Is this because I'm doing something wrong, or is it something in jqGrid?
This is the jqgrid code I am using (Note: I am using a dynamic column model that is generated by the server.)
function showPropertiesTable(selectedFileSet) { var urlCall = "loadFileSet?fileSet=" + selectedFileSet; var grid = $("#properties_list") var lastSel = -1 $.ajax({ type : "GET", dataType : "json", url : urlCall, success : function(result) { var columnData = result.propertiesList // list of data , columnModel = result.colModelList; // column model list definition grid.jqGrid({ datatype : 'local', data : columnData, pager : '#pager', viewrecords : true, rownumbers : true, colModel : columnModel, height : "auto", autowidth : true, editurl : 'editProperty', beforeSelectRow : function(rowid) { if (rowid !== lastSel) { grid.jqGrid('restoreRow', lastSel); lastSel = rowid; } return true; }, rowNum : 20, rowTotal : 2000, rowList : [ 20, 30, 50 ], loadonce : true, loadError : function(xhr, status, error) { alert('error'); } }); grid.jqGrid('navGrid', "#pager", { edit : false, add : false, del : true }); grid.jqGrid('inlineNav', "#pager"); }, error : function(x, e) { alert(x.readyState + " " + x.status + " " + e.msg); } });
Regards,
Jan-Willem Klomp
Most Users Ever Online: 715
Currently Online:
10 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66