我想发送要更新的行数据,但是当创建 jqgrid 时,数据类型设置为“本地”。我正在尝试在 onSubmiClick 中设置 dataType : "json" 并希望发送行数据(要发布到 REST 方法的数据)。这是我的 JqGrid 代码块。任何帮助表示赞赏。
var editSettings = {
recreateForm:true,
jqModal:false,
reloadAfterSubmit:true,
closeOnEscape:true,
closeAfterEdit:true,
addCaption: "Edit Scripts",
onclickSubmit: function(params,postdata) {
$.ajax({
type : "POST",
url : "/fnol-maintenance/reports/update",
contentType : "application/json; charset=utf-8",
data : {
jqGridData : postdata //I'm trying to figure out how to pass the row data being edited using jQgrid Form Edit.
},
dataType : "json",
asynch : false
});
return{};
}};
myGrid = $("#mygrid").jqGrid({
caption: "FNOL Maintenance Report",
datatype: "local",
colNames: myColNames,
colModel: myColModel,
pager: '#mypager',
//rowNum: 10000,
rowList: [10, 20, 50, 100],
viewrecords: true,
autowidth: true,
gridview: true,
ignorecase: true,
altRows: true,
altclass: 'myAltRowClass',
height: gridHeight, //commented to use browser vertical scrollbar
//height: "100%", //un-commented to use browser vertical scrollbar
loadtext: "Loading data...",
//forceFit: true
//headertitles: true,
footerrow: true,
userDataOnFooter: true,
editUrl: '/fnol-maintenance/reports/update'
});
myGrid.jqGrid('navGrid','#mypager',{edit:true,add:false,del:false,search:false}, editSettings );
jQuery("#mygrid").jqGrid('setCaption', (myjsongrid.reportTitle==""?'Maintenance Report':myjsongrid.reportTitle));
myGrid.setGridParam({datatype: "local"});
myGrid.setGridParam({data: mydata}).trigger("reloadGrid");
//jQuery("#mygrid").jqGrid('navGrid','#mypager',{del:false,add:false,edit:true,search:false});
//alert("after ajax");