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
Cell Edit - How to Return Server Error
01/10/2009
10:10
Avatar
djp
New Member
Members
Forum Posts: 2
Member Since:
01/10/2009
sp_UserOfflineSmall Offline

I am new to jqgrid and I'm trying to get cell editing against a remote server working.

To me, it is not clear from the documentation or examples what the server should return in response to cell edit ajax requests. I can submit and perform a database update okay, but if there is a database error, what ever I return from the server, the grid updates. The only way I have found to display an error is to set the HTTP response code to 400 or 500 range, but can return no useful error message.

How do I return a meaningful server error and display it?

Using php & JSON the best I can work out from the documentation is something like this, is this correct?

 echo json_encode(array(false, 'Update Failed'));

If so, how do I catch and display the error and prevent the grid from updating? Otherwise, what am I doing wrong.

Thanks, dj

01/10/2009
11:07
Avatar
seantsm28
California
Member
Members
Forum Posts: 5
Member Since:
12/08/2009
sp_UserOfflineSmall Offline

Here is how I take care of this.

        afterSubmitCell: function (serverresponse, rowid, cellname, value, iRow, iCol) {
               var mymess = serverresponse.responseText;
               var retbool = true;
               if (mymess != '1') { retbool = false; }
             var myret = [retbool,mymess];
               return myret;
        },

I make sure that my server update routines return a '1' if all goes well, otherwise they return an error message that explains what the problem is.  Then the grid will put up a dialog error with the returned message and nothing is changed in the cell.

02/10/2009
04:03
Avatar
djp
New Member
Members
Forum Posts: 2
Member Since:
01/10/2009
sp_UserOfflineSmall Offline

Thanks seantsm28, thats exactly the pointer I needed! All working now.

I was working in the right area, with afterSubmitCell event, but couldn't work out how to catch the response correctly.

It would help if the examples showed something like this.

Thanks again, dj

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
67 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