I want to send row data to be updated but when the jqgrid was created the datatype set to "Local". I'm trying to set the dataType : "json" in onSubmiClick and want to send the row data (data to be posted to REST method). Here is my JqGrid code block. Any help is appreciated.
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");