我尝试使用 jqgrid 并且现在遇到函数, 和successfunc
notaftersavefunc
将被调用的问题。errorfunc
afterrestorefunc
我的代码:
$("#list-nxfeatures").jqGrid({
url:'lib/nxfeatures.php',
datatype: 'xml',
mtype: 'GET',
colNames:['Id','Name', 'Description','Default','Allow change','Nolimit'],
colModel :[
{name:'id', index:'id', width:55},
{name:'name', index:'datasetid', width:150, editable:true},
{name:'description', index:'featureid', width:200, editable:true},
{name:'defaultvalue', index:'defaultvalue', width:80, align:'center',editable:true, edittype:"checkbox", editoptions: {value:"1:0"}},
{name:'allowchange', index:'allowchange', width:100, align:'center',editable:true, edittype:"checkbox", editoptions: {value:"1:0"}},
{name:'nolimit', index:'nolimit', width:80, align:'center',sortable:false,editable:true, edittype:"checkbox", editoptions: {value:"1:0"}}
],
pager: '#pager-nxfeatures',
rowNum:10,
rowList:[10,20,30,100],
rownumbers: true,
sortname: 'id',
sortorder: 'desc',
viewrecords: true,
gridview: true,
caption: 'Features',
editurl: "lib/modifynxfeatures.php",
height: 220,
width: 800
});
jQuery("#list-nxfeatures").jqGrid('navGrid',"#pager-nxfeatures",{edit:false,add:false,del:true});
jQuery("#list-nxfeatures").jqGrid('inlineNav', "#pager-nxfeatures", { addParams: {
rowID: "neu3",
addRowParams: {
oneditfunc: function () {
alert("edited");
},
successfunc: function (response) {
alert("success");
return true;
},
aftersavefunc: function (response) {
alert("aftersave");
},
errorfunc: function (rowid, response) {
alert("errorfunc");
},
afterrestorefunc :function (rowid) {
alert("afterrestorefunc");
}
}
}
});
jQuery("#list-nxfeatures").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false});
我的代码有什么问题?这oneditfunc
是完美的工作。