tonytomov / jqGrid

jQuery grid plugin
www.trirand.com
2.84k stars 1.2k forks source link

Method "saveRow" when url is "clientArray",errorfunc or successfunc never fire #1053

Closed hp3423 closed 9 months ago

hp3423 commented 9 months ago

Code like this: $("#grid").jqGrid('saveRow', rowid,{ url:"clientArray", successfunc:function(response){ console.log("successfunc"); }, errorfunc:function(rowid, response, satus){ console.log("errorfunc "); }, aftersavefunc:function(rowid, response, options){ console.log("aftersavefunc"); } }); when use "editrules" verification failed,can I do something else

tonytomov commented 9 months ago

Look here

Search for validationCell

Regards

hp3423 commented 9 months ago
$("#jqGrid").jqGrid({
  editurl: 'clientArray',
  ...
 colModel: [
    {
    label: "price",
        name: 'price',
        width: 140,
    editrules: {
        "number":true
    },
         editable: true 
    }
  ],
  ....
});
$("#btnSave").click(function(){
  $("#jqGrid").jqGrid("saveRow",rowid,{
    validationCell:function(elem, error, iRow, iCol){
    console.log(error);
    }
  });
});

when cell "price" input is not as number,and press the save button,the will open a alert,but not action the validationCell .

Could you give me an example? Thank you

tonytomov commented 9 months ago

The validateCell is a grid option and not a part of saveRow. Put this in grid option. Please read the docs carefully it is described at the top of the provided link.

hp3423 commented 9 months ago

Thank you for your patience. My English is not very good and I find it difficult to read the documents. This problem has been resolved.