サーバー(REST API)にjsonデータを投稿したいと思います。行をダブルクリックしてインラインで編集すると、「serializeRowData」が呼び出され、サーバーは本文で json 形式のメッセージを受け取ります。しかし、ページャーの小さな「+」アイコンをクリックすると、「serializeRowData」は呼び出されません。
私はバージョンを使用しています:
- JQuery 1.5.2
- JQグリッド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}
何か不足していますか?
例とともに、どんな助けでも大歓迎です。