I am new to jqgrid, thank you for the great work. I am building an application that retrieves a list of image files, and it would be a great ui enhancement if the user could simply click the image link in my grid and have it open in lightbox.
I have lightbox working on my site outside of jqgrid and it works correctly, the only requirement with the version of lightbox I am using is to add the class=”lightbox” to the href.
My grid is retreiving the links in the correct format with the lightbox class attribute, but clicking it only opens the image in a new browser window, bypassing lightbox.
I would be gratefull for any help on this. I'm not especially strong in javascript, so if you could keep it simple
Are you using custom or link formatter for displaying the link for the image inside the grid? Can you please use FireBug or some other debugging tool to make sure it is indeed in the correct format?
<span style="font-family: monospace, Helvetica, Arial, Verdana, sans-serif">Ineed the link tohaveaclassattribute of"lightbox"andtitle attribute(which become the image caption inlightbox.</span>
<span style="font-family: monospace, Helvetica, Arial, Verdana, sans-serif">Outside ofajqgrid,thishref will properly trigger lightbox(cut from the above xml andtested by itself):</span>
<span style="font-family: monospace, Helvetica, Arial, Verdana, sans-serif">So,using the same link,it works when notinagrid,anddoes notwork insideagrid(it opens the image inthe browser window).Iknow the lightbox.js isincluded properly(all my pages haveacommon php include forthe html head).</span>
1
<span style="font-family: monospace, Helvetica, Arial, Verdana, sans-serif">Ihave tried different load orders forthe js with no effect.</span>
I think the problem is that lightbox scans the page when it initializes, and modifies any links with the “lightbox” class (presumably adding a click handler). But it doesnt dynamically alter links that are created later.
Im not familiar with lightbox, but I would guess that it has a way of modifying a dynamically created link. Presumably there is a method you can call on the link (or a handler you can add manually).
So you would need your own formatter, which calls the grid's link formatter, and then does whatever lightbox needs you to do.