3 Replies Latest reply on Apr 10, 2009 4:43 AM by ilya_shaikovsky

    rich:datalist a4j actionparm

      I'm tying to implement a page with a list of thumbnail images along with the display of a large image of one of the thumbnails. Clicking on a thumbnail should change the larger image. I'm new to JSF so I could be easily doing something dumb. Code is:

       <s:graphicImage value="#{photoBean.getPhotoFile(adListBean.currentPhotoName)}"
       rendered="#{photoBean.exists(adListBean.currentPhotoName)}"
       width="400"
       id="primaryPhoto"/>
       <rich:dataList value="#{adListBean.currentAd.photos}"
       var="_classifiedAdPhoto"
       rendered="#{not empty adListBean.currentAd.photos}"
       rowClasses="adPhotoThumbnailList">
      
       <s:link view="/consumer/ClassifiedAd.xhtml" propagation="join">
       <s:graphicImage value="#{photoBean.getPhotoThumbnailBytes(_classifiedAdPhoto.filename)}"
       rendered="#{photoBean.exists(_classifiedAdPhoto.filename)}"
       width="80"/>
       <a4j:support event="onclick" reRender="primaryPhoto">
       <a4j:actionparam name="currentPhotoName" value="#{_classifiedAdPhoto.filename}"
       assignTo="#{adListBean.currentPhotoName}"/>
       </a4j:support>
       </s:link>
       </rich:dataList>
      


      The problem is that the actionparam value is not set on my adListBean. I read something somewhere that datalist has issues passing an actionparam. Maybe that is the problem? I'm using a datalist to get the photos aligned horizontally.

        • 1. Re: rich:datalist a4j actionparm

          I added a <a4j:form> in there - that got the parameter set. Now I just need to get rid of the ugly flicker/repaint.

          • 2. Re: rich:datalist a4j actionparm

            Do I need to send all the images to the client and put them in a list of divs with all hidden except one (or something like that?). The number of images is probably reasonable enough to do that although that may force some constraints on me that I don't have right now.

            anyone? I"m really not sure what direction to take here.

            • 3. Re: rich:datalist a4j actionparm
              ilya_shaikovsky

              you messed too many of controls there.. :)

              If you need to update part of the page just use a4j:commandLink instead of s:link with support inside. Current design is wrong. structure should be like:

              <a4j:outputPanel id="image"/>
              <h:graphicImage rendered=""/>
              </a4j:outputPanel>
              
              <dataList>
              <a4j:commandLink action=".." reRender="image">
              <a4j:actionparam...>
              <h:draphicImage src="..thumbnail">
              </a4j:commandLink>
              </dataList>
              


              Also if you not need in some concrete markup produced by iteration component - just use a4j:repeat instead of dataList.