Forum
I've got a table which has buttons in some of the cells, and I want to bind javascript functions to the buttons.
If I create a parameterless javascript function, and set the table gridcomplete to this function, then everything works fine - when the grid data has been loaded into the DOM, the gridcomplete event fires, my function is called, my buttons get their click handlers attached, and everything is good.
If I create a javascript function which takes a parameter (e.g. the table ID, when I have multiple tables on a page), and set the table gridcomplete to this function with a parameter (e.g. gridcomplete: bindIcons("table1")), the gridcomplete event fires before the data has been loaded into the grid, so the buttons don't exist yet, and the click handlers do not get attached. An alert dialog in my bindIcons function shows that the function does get called, and the parameter gets passed just fine - it just gets called too early!
14:53
Moderators
30/10/2007
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.
15:17
Moderators
30/10/2007
Hello,
To the gridComplete we do not pass any parameter and this event is called after everthing is into the dom.
Please check Your code.
Regards
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.
Thanks for the quick reply Tony, but I don't think the problem is in my code (although that's always a possibility ).
If I build the table with gridComplete: bindHelpIcons in the jqGrid initialisation, everything works perfectly.
If I build the table with gridComplete: bindHelpIcons("table1") in the jqGrid initialisation, the bindHelpIcons function is called before the table has even been drawn. The parameter gets passed to the function OK, and there is nothing else on the page which calls the function.
I'm quite happy to work around this by calling a parameterless function - I just wanted to let you know there may be an issue with your event firing.
I too have a similar problem: If I pass a function to gridComplete (to attach styles and events to the loaded table) it works fine. If I attach an object method with the same code as the working function the jquery collections in the method that I use to attach styles to are empty. It appears that this type of event is fired before the jqGrid is fully loaded.
As far as I can tell, it's b/c passing a function or method of any type is a fundamentally different Javascript operation that copying a function i.e. the difference between
and
Not sure of a workaround other than changing the way my backing object is set up. Some background on this (not so) subtle difference here. If anyone with greater JavaScript-fu can shed some light and help me accomplish what I need without breaking my model, I'd appreciate…
UPDATE: The answer came to me right after I posted this, and I suspect something similar would help @markbennet as well:
window.dataGrid.finalizeDataGrid()
},
Most Users Ever Online: 715
Currently Online:
41 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