Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
More error handling control with modal edit and delete
15/06/2009
10:05
Avatar
ingo
Member
Members
Forum Posts: 4
Member Since:
15/06/2009
sp_UserOfflineSmall Offline

I'm looking for a way to control what is displayed when an exception is thrown during postback (when pressing submit).

I couldn't figure it out so I suggest the following changes in grid.formedit.js. I added a function pointer parameter (in both editGridRow and delGridRow):
errorTextFormat

And in the complete callback to the ajax call, in the no success branch, I changed the code to:

if (Status != "success") {
    ret[0] = false;
    if ($.isFunction(rp_ge.errorTextFormat)) {
        ret[1] = rp_ge.errorTextFormat(data);
    } else {
        ret[1] = Status + " Status: " + data.statusText + " Error code: " + data.status;
    }
} else {

As you can see, this gives the caller a chance to analyze data and return a message of his or her choice.

If there's already a way to achieve this, please correct me.

Kind regards, Ingo

15/08/2009
12:24
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello Ingo!

You suggestion has till now no respond, so I’ll write my opinion about it.

I find you suggestion very useful. I had very close suggestion by the way, but not yet wrote it Smile. So I’ll write some arguments which describe why your suggestion is gut.

First of all, the standard error message:

ret[1] = Status+" Status: "+data.statusText +" Error code: "+data.status;

should has block quotes:

ret[1] = Status+" Status: '"+data.statusText+
         "
'. Error code: "+data.status;

(compare text "error Status: Internal Server Error Error code: 500" with the text "error Status: 'Internal Server Error'. Error code: 500")

and be localizable with additional properties in grid.locale-XX.js.

Next, respond from the server in the case of errors can contains detailed error description in the data.responseText. For example, in my environment server response has always JSON format and every exception throws from the server follows failed respond with the text of exception message in data.responseText as Detail property. For example,

throw new NotImplementedException ();

on the server follows to respond with code 500 and responseText

{"Detail":"The method or operation is not implemented."}

Other exceptions like a typical DBConcurrencyException () exception have responds in the same format, but another content of responseText of cause.  The standard error message displayed by editGridRow and delGridRow functions for all exceptions will be "error Status: Internal Server Error Error code: 500" every time.

A custom error format function like errorTextFormat introduced by you can makes error messages more understandable.

Best regards

Oleg

17/08/2009
07:02
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Since jqGrid is user oriented and mostley developed to make the developer life easy, so I added this request.

Best Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
58 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information