jqgrid error message on delete

2019-03-05 12:25发布

问题:

I've added the following code for my jqgrid:

changeTextFormat = function (data) {

                return "Activity or one from the same price group already used";
            };
            jQuery.extend(jQuery.jgrid.edit, {errorTextFormat: changeTextFormat }

)

It works great for insert and I get the error message appearing in the top of the dialog.

However I want something similiar for deletes. I want to make it that if during my server side delete I find a problem with the operation I throw an exception.

Based on this exception I want to pop up an error message.

Can anybody tell me how to go about this for the delete function?

回答1:

The setting $.jgrid.edit is not the only setting which are used during form editing. There are also $.jgrid.del, $.jgrid.nav, $.jgrid.search and $.jgrid.view which can be used.

If you need to define default implementation of errorTextFormat callback you can use

$.extend($.jgrid.del, { errorTextFormat: changeTextFormat });

in the same way like you use it with $.jgrid.edit.



标签: jqgrid