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
gridcomplete function with parameters called before grid is complete
22/07/2010
14:27
Avatar
markbennett
New Member
Members
Forum Posts: 2
Member Since:
22/07/2010
sp_UserOfflineSmall Offline

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!

22/07/2010
14:53
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

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.

22/07/2010
15:17
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

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.

22/07/2010
17:23
Avatar
markbennett
New Member
Members
Forum Posts: 2
Member Since:
22/07/2010
sp_UserOfflineSmall Offline

Thanks for the quick reply Tony, but I don't think the problem is in my code (although that's always a possibility Wink).

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.

21/10/2010
20:03
Avatar
jakemonO
Member
Members
Forum Posts: 16
Member Since:
20/08/2010
sp_UserOfflineSmall Offline

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.

loadComplete: window.dataGrid.finalizeDataGrid(),

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

loadComplete: window.dataGrid.finalizeDataGrid()

and

loadComplete: window.dataGrid.finalizeDataGrid

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:

      loadComplete: function() {
            window.dataGrid.finalizeDataGrid()
        },

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information