You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.
| Online: | 10 Members of 4090 |
| Forum: Seam Users |
28. Jul 2008, 11:14 CET | Link |
Hi, everyone.
I have a dataGrid of images. When a image is clicked on, a ModalPanel containing the image appears. The modalPannel also contains two buttons 'previous' and 'next'. When a button is clicked on, i want the modalPannel to display the previous or the next image in the list respectively.
Any help is appreciated.
Thank you.
Not sure this is a good idea or works (just typed it in here) but it should get you started.
You just need to save the current index of the image you are showing in your backing bean (which should be PAGE scoped) and increment and decrement that value.
In the dataGrid
<a4j:commandLink value="Show" action="#{backing.setImageIndex(varItem)}" reRender="theImage" oncomplete="#{rich:component('modalPanel')}.show();""/>In the modal panel
<h:graphicImage id="theImage" value="#{backing.currentImage}"/> <a4j:commandLink value="Prev" action="#{backing.prevImage}" reRender="theImage"/> <a4j:commandLink value="Next" action="#{backing.nextImage}" reRender="theImage"/>In the backing bean
public void setImageIndex(final String imageStr){ imageIndex = imageList.indexOf(imageStr); } public String getCurrentImage(){ return imageList.get(imageIndex); } public void nextImage(){ imageIndex++; }Indeed, it helped me get started, and I managed to solve the problem.
Would be a nice example to put in the wiki somewhere if you'd care to share it with us
Regards,
Ronald
A kind jBPM user and forum addict