jqgrid删除错误消息 [英] jqgrid error message on delete

查看:76
本文介绍了jqgrid删除错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为jqgrid添加了以下代码:

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?

推荐答案

设置$.jgrid.edit不是在表单编辑期间使用的唯一设置.还可以使用$.jgrid.del$.jgrid.nav$.jgrid.search$.jgrid.view.

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.

如果您需要定义errorTextFormat回调的默认实现,则可以使用

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

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

就像您将其与$.jgrid.edit一起使用一样.

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

这篇关于jqgrid删除错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆