1
我嘗試使用jqgrid並且現在有問題,函數successfunc
,aftersavefunc
,errorfunc
和afterrestorefunc
不會被調用。jqgrid在addrow之後不會調用successfunc
我的代碼:
$("#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
是完美的工作。