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_Related Related Topics sp_TopicIcon
onComplete Handler Hook over all Ajax Calls from jqGrid
06/04/2011
14:35
Avatar
sonarok
New Member
Members
Forum Posts: 1
Member Since:
06/04/2011
sp_UserOfflineSmall Offline

hi guys,

after trying around 2 days without a good solution i could need your help 🙂

first of all what we want to do is a whole hook / wrapper for all jqgrid ajax calls.

the target is that our server can always answer with a json response looking like this:

ack: success / fail

timestamp: 1111111111111111

error: errorObj{errorCode:123, errorMsg:abc}

jqgrid_payload: {the realdata for our jqgrid , also jqgrid json error data, etc.}

action: actionObj{}

our hook code would parse this, take care of all additional data and forward only the payload data to our jqgrids.

this solution is needed as a central point of application control.

for example if a user session expires we want to redirect the user to the login screen. this could be done by a special errorCode.

if the user change some data we want to be able to switch off the editing on special fields (controlled by the server).

also we need to trigger other UI Componets depending on changes that the jqGrid send to the server and the server decide what should happen.

i started to play around with datatype: function ().... and this gets near a solution but like i saw this is only triggern on reload/fetch calls, for validation or editing other ajax calls are used...

all onComplete events dont work because they are triggered additionaly to the normal ajax flow.

really dont remember all my trys but i had alot 🙁

also it would be a solution for us if we get a list of hook points where we could write our own ajax calls, always use the central responseParsing function and forward the payload data to our jqgrid...

hope someone has a solution for this. thx!

06/04/2011
19:15
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello,

I find your question interesting. Some versions ago it was introduced the serializeGridData event which allows to preprocess the data before the ajax call. Introducing of another function like preprocessServerResponse which will be inserted at the begining of the success handle could solve your problem.

To implement your requirement inthe current version of jqGrid you can use dataFilter parameter of jQuery.ajax which can be set with respect of ajaxGridOptions parameter. It allows you to do postprocessing of the results. The look at here and here can clear everithing.

Best regards
Oleg

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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