4 Replies Latest reply on Sep 5, 2007 11:41 AM by jeje47

    reRender problem

    jeje47

      Hi, I am struggeling with the rerendering of a datatable in a modalPanel. I have a list of user groups and a commandbouton which opens a modalPanel which contains all the groups not already added to the user.
      I would like to update the list in the modal panel each time I add groups but the list is always the same. I wonder if you can say to me what I'm doing wrong.

      Thanks and sorry for my english.

      PS: "mainForm" in the reRender tag is my unique form that contains all my forms

      <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core" xmlns:r="http://richfaces.ajax4jsf.org/rich"
       xmlns:s="http://jboss.com/products/seam/taglib" xmlns:a="https://ajax4jsf.dev.java.net/ajax"
       xmlns:ui="http://java.sun.com/jsf/facelets">
      
       <r:tabPanel id="userPanel" height="80%" width="100%" styleClass="tabPanel"
       rendered="#{(managedUser != null) && (administrationPage == true)}">
      
       <r:tab label="#{messages['userform.preferences']}" styleClass="tab">
      
       some content...
      
       </r:tab>
      
       <r:tab label="#{messages['userform.groups']}" styleClass="tab">
      
       <!-- The user groups datatable -->
       <div class="usersDataTable">
       <r:panel styleClass="usersDataTablePanel">
       <h:dataTable rendered="#{managedUser.groups != null}" id="userGroupTable"
       value="#{managedUser.groups}" binding="#{userManager.groupList.targetList}" var="group"
       width="100%" border="0">
       <h:column>
       <h:selectBooleanCheckbox
       rendered="#{!managedUser.readOnly && s:hasRole('MANAGE_USERS')}"
       binding="#{userManager.groupList.checkboxTargetList}" />
       </h:column>
       <h:column>
       <h:graphicImage value="img/groups/group24.png" />
       </h:column>
       <h:column>#{group.name}</h:column>
       <h:column>#{group.description}</h:column>
       </h:dataTable>
       <h:outputText value="#{messages['userform.noUserGroup']}" rendered="#{empty managedUser.groups}" />
       </r:panel>
       </div>
      
       <!-- The buttons to add and delete groups to the user -->
       <div class="usersDataTableButtons">
       <div class="usersDataTableButtonAdd">
       <a:commandButton rendered="#{!managedUser.readOnly && s:hasRole('MANAGE_USERS')}"
       style="filter:alpha(opacity=20);-moz-opacity:0.8" onmouseover="rendrevisible(this,0)"
       onmouseout="rendrevisible(this,1)" image="img/fonctional/add.button.list32.png"
       onclick="javascript:Richfaces.showModalPanel('mp',{width:450, top:200})">
       </a:commandButton>
       </div>
       <div class="usersDataTableButtonDelete">
       <a:commandButton rendered="#{!managedUser.readOnly && s:hasRole('MANAGE_USERS')}"
       style="filter:alpha(opacity=20);-moz-opacity:0.8" onmouseover="rendrevisible(this,0)"
       onmouseout="rendrevisible(this,1)" image="img/fonctional/delete.button.list32.png"
       action="#{userManager.deleteUserGroups}" reRender="mainForm" />
       </div>
       </div>
       <!-- The modal window opened when we want to add groups to the user -->
       <r:modalPanel id="mp" minHeight="300" minWidth="450" height="300" width="500" zindex="2000"
       rendered="#{(managedUser != null) && (administrationPage == true)}">
       <f:facet name="header">
       <h:outputText value="#{messages['userform.addGroups']}" />
       </f:facet>
       <f:facet name="controls">
       <h:graphicImage value="img/fonctional/close14.png" class="usersModalPanelClose"
       onclick="Richfaces.hideModalPanel('mp')" />
       </f:facet>
       <h:outputText value="#{managedUser.login}"/>
       <!-- The groups that can be added to the user -->
      I cannot <r:panel styleClass="usersModalPanel">
      reRender this list --> <h:dataTable id="allGroupsTable" value="#{userManager.allGroups}"
       binding="#{userManager.groupList.sourceList}" var="group" width="90%" height="100%"
       border="0">
       <h:column>
       <h:selectBooleanCheckbox binding="#{userManager.groupList.checkboxSourceList}" />
       </h:column>
       <h:column>
       <h:graphicImage value="img/groups/group24.png" />
       </h:column>
       <h:column>#{group.name}</h:column>
       <h:column>#{group.description}</h:column>
       </h:dataTable>
       <h:outputText value="#{messages['userform.allGroupAlreadyAdded']}"
       rendered="#{userManager.allGroupsSize == 0}" />
      
       </r:panel>
      
       <!-- The buttons to perform or cancel the add -->
       <div class="usersModalPanelButtons">
       <a:commandButton value="Cancel" onclick="Richfaces.hideModalPanel('mp')" reRender="mainForm"
       styleClass="usersModalPanelButton" />
       <a:commandButton value="OK" action="#{userManager.addUserGroups}" reRender="mainForm"
       onclick="Richfaces.hideModalPanel('mp')" styleClass="usersModalPanelButton" />
       </div>
       </r:modalPanel>
       </r:tab>
       </r:tabPanel>
      </ui:composition>


        • 1. Re: reRender problem
          jeje47

          If I switch to the first tab (label="#{messages['userform.preferences']}") and then if I go back to the groups tabe (label="#{messages['userform.groups']}") the list is updated. It appears that there is a problem with the reRender of a content in a modalPanel.

          Any ideas?

          • 2. Re: reRender problem
            jeje47

            I think the problem is due to the modalPanel component because if I perform the add without a modalPanel (the two list are side by side) the reRender seams to work.

            Do I have to make a special think to reRender a content contained in a modalPanel?

            Thanks.

            • 3. Re: reRender problem
              nbelaevski

              No, you shouldn't make a special re-rendering. We'll check the issue...

              • 4. Re: reRender problem
                jeje47

                Ok it was my fault! I've no form on my modalPanel and I've embedded the modalPanel in an existing form... Now I've fixed it, everything is doing great!

                I've found the solution in the developper guide of richfaces...sorry :)!