jqgrid在addrow之后不调用successfunc

时间:2012-10-04 11:02:35

标签: php javascript jqgrid

我尝试使用jqgrid,现在问题是不会调用函数successfuncaftersavefuncerrorfuncafterrestorefunc

我的代码:

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

1 个答案:

答案 0 :(得分:1)

找到您的帖子,因为我遇到了与您相同的问题。找到了解决方案。将其发布在此供其他人参考。

addParams:{
    addRowParams:{
        oneditfunc:function(){
            alert("edited");
        }
    }
},
editParams:{
    successfunc:function(response){
        alert("success");
        return true;
    }
}