1

我尝试使用 jqgrid 并且现在遇到函数, 和successfuncnotaftersavefunc将被调用的问题。errorfuncafterrestorefunc

我的代码:

$("#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是完美的工作。

4

1 回答 1

1

找到你的帖子,因为我遇到了和你一样的问题。找到了解决方案。在这里发布以供其他人参考。

addParams:{
    addRowParams:{
        oneditfunc:function(){
            alert("edited");
        }
    }
},
editParams:{
    successfunc:function(response){
        alert("success");
        return true;
    }
}
于 2012-11-20T08:33:24.513 回答