Forum


11:16

02/01/2009

After upgrading to 3.5.3 from 3.4.2 $("#gridName").trigger("reloadGrid") stopped working from the function called on LoadComplete but $("#gridName").trigger("reloadGrid") works from a button on the page once the grid is loaded.
The grid is loaded via json fed from a url. The server gets the initial request on load but never gets the second reload fired on loadComplete.
$("#gridName").jqGrid({
url: 'WSGridGetJson.aspx',
datatype: "json",
mtype: 'POST', ..........
I've traced the process to grid.base.js line 588
populate = function () {
if(!ts.grid.hDiv.loading) { ...
It appears that populate will only happen if the grid is not loading and I assume that loadComplete is part of the loading process. This must have been different in version 3.4.2.
Can I clear the loading flag from on loadComplete process. If so, how and what might be the reprecussions of such a change is standard process? Can PostData be set before the grid is created in verison 3.5.3. ( I believe this method of shaping grid data was devised back in version 3.1, perhaps the process has changed since then)
The grid is reloaded on loadComplete to set PostData to variables acquired after the page containing the grid is created to control the loaded data set.
Called from on loadComplete function.
$("#gridName").setPostData({ un: "x", ci: "y", pll: "z" });
$("#gridName").trigger("reloadGrid");
12:09

02/01/2009

The answer to my question is:
there is an event that runs before the first request. It is named appropriately enough, beforeRequest:
I called appendPostData in that event process to add the required variables.
$(”#gridName”).appendPostData({ un: “x”, ci: “y”, pll: “z” });
This is a much more efficient way of controlling the dataset on first load.
I found its definition in the jqGrid Wiki event section. The wiki is not complete yet but seems to include newly added functionality.
Thank you Tony for adding this event.
12:44

Moderators
30/10/2007

Hello Rob,
You can simple (as described in grid options) whitout using any event
jQuery("#mygrid").jqGrid({
...
postData: { un: “x”, ci: “y”, pll: “z” },
...
});
This will apend the items to postdata array
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.
Most Users Ever Online: 715
Currently Online:
78 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66