Forum


02:18

24/06/2009

Using the custom formatter, I can add images to jqgrid cells. But the images are in their small version, and I would like to add a tooltip for the images. Basically, users can view the big version of image when they mouseover the small image.
I played with the setCell function and assigned image src directory to 'title'. The tooltip displayed, but just the string of image src.
My question is how to add the actual image in the tooltip?
setCell(rowid, 'colName', '','',{'title':"<img sr='/images/picture_big.jpg'>"})
Thanks very much.
03:08

10/08/2009

setCell can be used set only title attribute on the corresponding <td> html element like <td title="My ToolTip">. So setting of html code on the place of html attributes will not work.
To implement the behavior which you need you have to bind all <td> elements (grid cells) with mouseover and mouseout functions which will be display the custom tooltips with images. You can do such binding inside of loadComplete event handle.
To make your implementation easy you can try to use some existing ToolTip plugin like http://bassistance.de/jquery-p.....n-tooltip/, http://plugins.learningjquery......l and so on.
Best regards
Oleg
03:27

30/01/2010

01:24

17/02/2009

Hi all,
I used an extension called jquery.qtip plugin to do this in my application.
And it works well with Firefox and IE.
To see the plugin for dynamically loaded thumbnail tooltip, see this example here:
http://craigsworks.com/project...../thumbnail
You can apply the same way in Jqgrid.
To see an example, take the "JSON Data" sample in "Loading data section" section of jqgrid demo.
You want to show a thumbnail tooltip when the cursor is on "Inv No" column.
You define that "inv no" column content is the basename of an image called "<content>.jpg" file.
So, the content "1″ will show in a tooltip the "1.jpg image", "2″ shows in a tooltip the "2.jpg" image and so on…
To do this, on the server side, make a folder "images" containing all the image files 1.jpg to 13.jpg.
In jqgrid, to link the column "Inv No" content with a thumbnail tooltip, insert the code (in jsonex.js) after ColModel, line 14 with the
"loadComplete" event handle like this:
loadComplete : function() {
$("#list2 tr").each(function(){
var col1= $(this).find("td:eq(0)"); // First column Inv No
var thumbnail_url="images/"+$(col1).html()+".jpg"; // Build image link
$(col1).removeAttr("title"); // Remove old title
var image='<img src="'+thumbnail_url+'" alt="Chargement imagette…" width=100 height=100 />';
$(col1).qtip({
content: image,
position: {
corner: {
tooltip: 'bottomMiddle',
target: 'topMiddle'
}
},
style: {
tip: true, // Give it a speech bubble tip with automatic corner detection
name: 'blue'
}
});
});
}, // loadComplete
You have to download the jquery.qtip extension at:
http://bazaar.launchpad.net/~c...../1.0/files
Note: you need this special version because it fixes a bug in the ajax content download
(For more explanation: http://craigsworks.com/project.....ax-and-net )
Put the downloaded version in a folder js/jquery.qtip
And declare the jquery.qtip extension in the head of (jqgrid.html) in the javascript section like this:
<script src="js/jquery.qtip/jquery.qtip-1.0.min.js" type="text/javascript"></script>
To summerize, if your Jqgrid_demoXX is installed on your hard disk on <your path>, the new folders were here:
<your path>Jqgrid_demo36/images
<your path>Jqgrid_demo36/js/jquery.tip
Two files to change: <your path>Jqgrid_demo36/jqgrid.html
<your path>Jqgrid_demo36/jsonex.js
Hope this will help.
14:19

30/01/2010

Dear ppr,
Thank you for your guide to jquery qtip. I was success to follow your step but I got problem when I want to change thumbnail tooltip when the cursor is on "Tax" column (fifth column).
I have changed the code to:
var col1= $(this).find("td:eq(4)"); // Fifth column Tax
and the image did not show.
Could you help me solve this problem, please? Thank you
Best Regards,
Candra
15:08

30/01/2010

Dear all,
You gave an example that "inv no" column content is the basename of an image called "<content>.jpg" file.
So, the content "1″ will show in a tooltip the "1.jpg image", "2″ shows in a tooltip the "2.jpg" image and so on…
How if I want to have a thumbnail based on primary ID of a row?
for example a row with primary ID = xxx will show in a tooltip the "xxx.jpg image" and so on...
Best Regards,
Candra
10:15

17/02/2009

Hi Candra,
I try answering to your 2 questions:
1/ How to show the tooltip image on "Tax" column (and take the content from "Inv No" Column) ?
In your example, You can do that:
- After the line
you add this line:
- and you replace the line
by this one:
Now the tooltip image will show on "Tax" column and the image tooltip is build from "Inv No" column.
2/ How to show the tooltip image where the basename of image file is based on content from "ID of row" ?
In this Jqgrid example, the "id" of row is localized in the html code "<tr id="<content ID row>" ... >".
So you need to get the content of the attribute of "id" from "<tr...>".
To do this:
- after the line in your example
you add this line:
- and you replace this line:
by this one:
Hope this will help.
Best regards
Phil
17:37

30/01/2010

Most Users Ever Online: 715
Currently Online:
89 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