user1697051
user1697051

Reputation: 471

jqgrid don't call successfunc after addrow

I try to work with the jqgrid and have now the problem that the function successfunc, aftersavefunc, errorfunc and afterrestorefunc not will be called.

My code:

$("#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});

What is wrong on my code? The oneditfunc is work perfect.

Upvotes: 1

Views: 1627

Answers (1)

Mark
Mark

Reputation: 33

Found your post as I had the same issue as yours. Found the solution. Posting it here for others reference.

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

Upvotes: 1

Related Questions