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
loadBeforeSend
25/08/2008
15:51
Avatar
smlong426
Member
Members
Forum Posts: 4
Member Since:
23/08/2008
sp_UserOfflineSmall Offline

I believe there is a bug in the loadBeforeSend method.

If I override this event and set some ID field to pass back to the server, on initial load, the ID that is set does not appear to be passed in the POST request.

IE - I have a simple grid with employees.  One can enter their last name into a text box and click a search button to search for the employee.  No matter what is entered on the first search (page load), all employees are returned.  Clicking the search button a 2nd and subsequent times returns the correct result set.

I viewed the XHR with Firebug and confirmed that a blank value is being passed in the POST method on the first search.

My code is pretty simple.  I simply set the loadBeforeSend property of the grid to call this function:

        $('#gridEmp').appendPostData({
            lastName: $("#TextBox1").val()
        });

Right now, the only way I have found to fix this is to not use the loadBeforeSend override.  I have made a function that instantiates my grid and passes the 'initial' post data to it on through a jQuery ready function.  For subsequent POST data, I use other events (like row select) or handle appending/setting the POST data outside of the grid as in the case of my simple search.

Anyhelp is appreciated.

26/08/2008
03:08
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

You can not do this in this event. jqGrid uses a standart ajax beforeSend

event. As of jQuery docs with this event you can only modifi the header of the request, but not the data. Here is the help.

beforeSend

"A pre-callback to modify the XMLHttpRequest object before it is sent. Use this to set custom headers etc. The XMLHttpRequest is passed as the only argument. This is an Ajax Event. You may return true in function to cancel the 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.

26/08/2008
07:59
Avatar
smlong426
Member
Members
Forum Posts: 4
Member Since:
23/08/2008
sp_UserOfflineSmall Offline

Ah - Thanks Tony.  I thought I must have misunderstood the documentation.

Is there any place where the data can be modified prior to the server request?

Right now, the only thing I have found is to do something like make a js function for instantiating the jqgrid and accepts a single parameter representing the initial postData.  I can also achieve the same result with an initial hidden grid.

Anyhow, just curious.  I really like your plugin, Tony.  My experience prior to now has been using server controls for all grids.  But I think the user experience with your jqgrid seems much closer to a desktop application.

27/08/2008
02:28
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

This have sense - We have loadComplete, but we do not have event which ia arised before the request. I will consider this and maybe add such event.

Thanks

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:
24 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