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.
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.
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 useerrorfunc
parameter of the editRow.You can easy see the difference between errorTextFormat and
errorfunc
parameter. If in theerrorTextFormat
you should return the error message which will be used in the error message, the callback functionerrorfunc
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.