2 Replies Latest reply on Sep 23, 2008 9:51 PM by bashan

    a4j ajax and datatable

    bashan

      I have a pretty complex structure that brings forum entry details. somewhere in the structure I have this code for selecting a picture:




                  <a4j:commandLink action="#{forumEntryAction.selectPicture}" reRender="groupPicture" oncomplete="" immediate="true">
                    <f:param name="pictureId" value="#{picture.mediaId}"/>
                    <h:graphicImage url="#{path:getPictureThumbUrl(picture)}" styleClass="picture"/>
                  </a4j:commandLink>




      some more few lines ahead I have this code for showing selected picture:


          <a4j:region id="regionPicture">
            <h:panelGroup id="groupPicture">
      
              <h:panelGroup rendered="#{not empty forumEntryAction.selectedPicture}">
                <h:panelGroup>
      
                  <table width="100%" cellpadding="0" cellspacing="0">
                    <tr>
                      <td align="center">
                        <h:outputText value="#{forumEntryAction.selectedPicture.name}" />
                      </td>
                    </tr>
                    <tr>
                      <td align="center">
                        <h:graphicImage url="#{path:getPictureUrl(forumEntryAction.selectedPicture)}" styleClass="picture"/>
                      </td>
                    </tr>
                    <tr>
                      <td align="center">
                          <h:outputText value="#{forumEntryAction.cameraModel}" style="font-weight:bold"/>
                          <h:outputText value="&amp;nbsp;" escape="false"/>
                          <h:outputText value="Date Taken: "/><h:outputText value="#{forumEntryAction.dateTaken}"
                                                                            style="font-weight:bold"/><h:outputText value="&amp;nbsp;"
                                                                                                                    escape="false"/>
                          <h:outputText value="Metering Mode: "/><h:outputText value="#{forumEntryAction.meteringMode}"
                                                                               style="font-weight:bold"/><h:outputText
                          value="&amp;nbsp;" escape="false"/>
                          <h:outputText value="Exposure Program: "/><h:outputText value="#{forumEntryAction.exposureProgram}"
                                                                                  style="font-weight:bold"/><h:outputText
                          value="&amp;nbsp;" escape="false"/>
                          <br/>
                          <h:outputText value="F-Number: "/><h:outputText value="#{forumEntryAction.FNumber}"
                                                                          style="font-weight:bold"/><h:outputText value="&amp;nbsp;"
                                                                                                                  escape="false"/>
                          <h:outputText value="Exposure Time: "/><h:outputText value="#{forumEntryAction.exposureTime}sec"
                                                                               style="font-weight:bold"/><h:outputText
                          value="&amp;nbsp;" escape="false"/>
                          <h:outputText value="ISO: "/><h:outputText value="#{forumEntryAction.ISO}"
                                                                     style="font-weight:bold"/><h:outputText value="&amp;nbsp;"
                                                                                                             escape="false"/>
                          <h:outputText value="Focal Length: "/><h:outputText value="#{forumEntryAction.focalLength}mm"
                                                                              style="font-weight:bold"/><h:outputText
                          value="&amp;nbsp;" escape="false"/>
                          <br/>
                          <h:outputText value="Exposure Compensation: "/><h:outputText
                          value="#{forumEntryAction.exposureCompensation}" style="font-weight:bold"/><h:outputText value="&amp;nbsp;"
                                                                                                                   escape="false"/>
                          <h:outputText value="Flash Exposure Compensation: "/><h:outputText
                          value="#{forumEntryAction.flashExposureCompensation}" style="font-weight:bold"/><h:outputText
                          value="&amp;nbsp;" escape="false"/>
                          <h:outputText value="Flash: "/><h:outputText value="#{forumEntryAction.flash}" style="font-weight:bold"/>
                      </td>
                    </tr>
                  </table>
                </h:panelGroup>
              </h:panelGroup>
            </h:panelGroup>
          </a4j:region>



      Now, when this code is standalone, everything is working fine. But, when I wrap this entire code in a dataTable, meaning I would like to show several forum entries and not only once, the region is not being updated. When removing the a4j ajax support, everything is working fine, but screen is refreshed.


      Is there anything with aj4 preventing it from being refreshed in a datatable? I suspect the problem is because the aj4 doesn't know how to refresh the region, maybe because reRender id is not set properly. When debugging, the ajax command is sent to the server. it seems like the problem is only on the refresh...


      Thanks,
      Guy.

        • 1. Re: a4j ajax and datatable
          gjeudy

          hi guy,


          I don't think you can do a partial refresh of the dataTable with a region.


          Richfaces Ajax attributes



          This might be important inside the h:dataTable like components where using a4j:region is impossible due to the h:dataTable component architecture.
          • 2. Re: a4j ajax and datatable
            bashan

            Thanks for your answer. That explains things... I guess I will have to make the whole datatable a region, and simply refresh the entire table. Maybe also Seam web remote could help doing the job...