来自服务器端异常的jqGrid错误消息

编程入门 行业动态 更新时间:2024-10-25 20:27:38
本文介绍了来自服务器端异常的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 for edits it's not working so well. Instead a massive dialog is appearing with the error message.

我目前正在考虑这是因为我正在使用内联编辑,因此它必须弹出一个全新的对话框.有没有一种方法可以更好地格式化此对话框.我非常确定,对于内联编辑,在出现异常后甚至没有通过changeTextFormat运行.

I'm currently thinking that it's because I'm using inline editing so it has to pop up a whole new dialog. Is there a way to format this dialog better. I'm pretty sure that for the inline edits it's not even running through changeTextFormat after an exception.

推荐答案

是正确的.通过更改jQuery.jgrid.edit,您可以仅设置 errorTextFormat 用于表单编辑.如果使用内联编辑,则必须使用errorfunc参数noreferrer> editRow .

It's correct. By changing of jQuery.jgrid.edit you set errorTextFormat only for the form editing. In case of the usage inline editing you have to use errorfunc parameter of the editRow.

您可以轻松地看到 errorTextFormat 和errorfunc参数.如果在errorTextFormat中应该返回将在错误消息中使用的错误消息,则回调函数errorfunc应该 display 相应的错误消息本身.如果要使错误对话框的外观相同,可以使用$.jgrid.info_dialog方法.在答案您可以找到相应的代码片段.另请参见代码片段的jqGrid源代码.

You can easy see the difference between errorTextFormat and errorfunc parameter. If in the errorTextFormat you should return the error message which will be used in the error message, the callback function errorfunc should display the corresponding error message itself. If you want to have the same look of the error dialog you can use $.jgrid.info_dialog method. In the answer you could find the corresponding code fragment. See additionally the code fragment of the jqGrid source code.

更多推荐

来自服务器端异常的jqGrid错误消息

本文发布于:2023-11-13 01:39:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1583056.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:服务器端   异常   错误   消息   jqGrid

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!