jQuery jqGrid Show message when an edit row is complete

天涯浪子 提交于 2019-11-26 16:44:14
Oleg

First of all the option closeAfterEdit:true follows to closing of the edit form after the successful server response. You should change the setting to the default value closeAfterEdit:false to be able to show anything.

Next I would recommend you to use navigator toolbar instead of creating a button after outside of the grid. In the case you can use

var grid = jQuery("#tabImprese");
grid.jqGrid('navGrid','#pager', {add:false,del:false,search:false}, prmEdit);

One more good option is to use ondblClickRow event handler

ondblClickRow: function(rowid) {
    $(this).jqGrid('editGridRow',rowid,prmEdit);
}

(see here) or both ways at the same time.

In any way you have to define the options of editGridRow method (the prmEdit). It's important to know that afterSubmit will be called only if the server response not contains error HTTP status code. So you should use errorTextFormat to decode the error server response. The afterSubmit event handler you can use to display status message.

In the demo I used only errorTextFormat to demonstrate both displaying of the status and error message:

The status message goes away in 3 seconds:

The corresponding demo you will find here.

In real example you will of cause place the code writing status message inside of afterSubmit event handler and the code which returns the error message inside of errorTextFormat.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!