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
use existing div for the toolbar
05/11/2008
18:17
Avatar
alvin
Member
Members
Forum Posts: 4
Member Since:
06/11/2008
sp_UserOfflineSmall Offline

First, thanks for the great plugin.

I like the toolbar feature and the examples I looked at used the following pattern:

$('#t_list').append('<html here>')

which did work for me.

I prefer adding HTML to the toolbar using a templating language.

This can be accomplished in jqGrid by applying this patch (jqGrid 3.3; Date: 2008-10-05 rev 62)

It worked for me on FF3 on Mac.

Sample usage to add '<div id="toolbar">good stuff here</div>':

jQuery('#list').jqGrid({
       <other params here>
        toolbar: ['#toolbar', "bottom"]

});

Is there an easier way to use an existing div as a toolbar?

Thanks

alvin

--- a/jqGrid/js/grid.base.js
+++ b/jqGrid/js/grid.base.js

@@ -1366,7 +1369,8 @@ $.fn.jqGrid = function( p ) {
                $(grid.cDiv).append("<table class='Header' cellspacing='0' cellpadding='0' border='0'><tr><td class='HeaderLeft'><i
                $(grid.cDiv).insertBefore(grid.hDiv);
                if( ts.p.toolbar[0] ) {
-                       grid.uDiv = document.createElement("div");
+                       if( ts.p.toolbar[0] === true) {grid.uDiv = document.createElement("div");}
+                       else {grid.uDiv = $(ts.p.toolbar[0]);}
                        if(ts.p.toolbar[1] == "top") {$(grid.uDiv).insertBefore(grid.hDiv);}
                        else {$(grid.uDiv).insertAfter(grid.hDiv);}
                        $(grid.uDiv,ts).width(grid.width).addClass("userdata").attr("id","t_"+this.id);

05/11/2008
21:46
Avatar
ycceric
Member
Members
Forum Posts: 8
Member Since:
05/11/2008
sp_UserOfflineSmall Offline
06/11/2008
10:00
Avatar
alvin
Member
Members
Forum Posts: 4
Member Since:
06/11/2008
sp_UserOfflineSmall Offline

One caveat: the div passed in to the toolbar is given the id='#t_list'

For example:

<div id='#will_be_renamed'><div id='#toolbar'>Some html</div></div>

jQuery('#list').jqGrid({

  <other params>

  toolbar: ['#will_be_renamed', 'top']

});

// Next javascript line will see:

jQuery('#t_list')  // instead of '#will_be_renamed'

jQuery('#toolbar') // does work

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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