我想将 json 数据发布到服务器(REST API)。当我现在双击一行以编辑内联时,会调用“serializeRowData”,并且我的服务器会在正文中收到一条 json 格式的消息。但是当我单击寻呼机中的小“+”图标时,不会调用“serializeRowData”。
我正在使用版本:
- jQuery 1.5.2
- JQGrid 4.4.1
我的网格看起来像:
$("#dbgrid").jqGrid({
url: 'rest/config/dbs',
editurl: 'rest/config/db',
datatype: "json",
height: 255,
width: 600,
colNames:['ID', 'Env', 'Hostname', 'Name', 'Port', 'Service Name', 'SID'],
colModel:[
{name:'id',index:'id', width:30, sorttype:'int'},
{name:'env',index:'env', editable:true, width:50},
{name:'hostName',index:'hostName', editable:true, width:200},
{name:'name',index:'name', editable:true, width:200},
{name:'port',index:'port', editable:true, width:30},
{name:'serviceName',index:'name', editable:true, width:30},
{name:'sid',index:'sid', editable:true, width:30}
],
jsonReader: {
repeatitems: false,
id: "id",
},
rowNum:50,
rowTotal: 2000,
rowList : [20,30,50],
loadonce:false,
mtype: "GET",
rownumbers: true,
rownumWidth: 40,
gridview: true,
pager: '#pdbgrid',
sortname: 'id',
viewrecords: true,
sortorder: "asc",
caption: "Database Servers" ,
ajaxRowOptions : {
type :"POST",
contentType :"application/json; charset=utf-8",
dataType :"json"
},
serializeRowData: function(postdata){
return JSON.stringify(postdata);
}
});
$("#dbgrid").jqGrid('navGrid','#pdbgrid',{edit:true,add:true,del:true}
我错过了什么吗?
任何帮助以及示例将不胜感激。