0 Replies Latest reply on Oct 22, 2012 10:25 AM by serdard

    problems while reusing a modalPanel with link parameters

    serdard Newbie

      Hi,

      I'm having problems while using a modalPanel as a template.

      i have two user entities in my backingBean and i want to set them via an userSearchTemplate.

      Here is my code,

       

      my modalPanel (selectUserTemplate.xhtml);

       

       

      <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:a="http://richfaces.org/a4j"
          xmlns:rich="http://richfaces.org/rich">
      
          <div class="prop" style="text-align: left"><s:label styleClass="name #{invalid?'errors':''}" style="#{labelStyle}">
              <ui:insert name="label" />
              <ui:insert name="input" />
              <a:commandLink value="" action="#{util.fillUsers}" oncomplete="Richfaces.showModalPanel('modalPanelUser')" ajaxSingle="true"
                  reRender="panelGridUsers" >
                  <h:graphicImage value="/img/icon-list.gif" style="vertical-align:bottom;" />
              </a:commandLink>
              <rich:modalPanel id="modalPanelUsers" height="400" width="600" >
              <f:facet name="header">
                  <h:panelGroup>
                      <ui:insert name="listCaption" />
                  </h:panelGroup>
              </f:facet>
              <f:facet name="controls">
                  <h:panelGroup>
                      <h:graphicImage value="/img/close_icon.gif" styleClass="hidelink" id="hidelink" />
                      <rich:componentControl for="modalPanelUsers" attachTo="hidelink" operation="hide" event="onclick" />
                  </h:panelGroup>
              </f:facet>
      
              <h:panelGrid columns="1" id="panelGridUsers" width="100%">
                  <rich:dataTable style="width:100%" rows="10" value="#{userListGrid}" var="userRow" rowClasses="row1,row2"
                      onRowMouseOver="this.style.backgroundColor='#FFFFD4'" 
                      onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'" 
                      >
                      <rich:column >
                          <f:facet name="header">
                              <h:outputText value="USER NAME" />
                          </f:facet>
                          <h:outputText value="#{userRow.name}" />
                      </rich:column>
                      <rich:column>
                          <ui:insert />
                      </rich:column>
                      <f:facet name="footer">
                          <rich:datascroller />
                      </f:facet>
                  </rich:dataTable>
      
              </h:panelGrid>
          </rich:modalPanel></div>
      
      </ui:composition>
      
      

       

       

       

       

      and the usage;

       

       

                       <s:decorate id="selectUser1" template="selectUserTemplate.xhtml">
                          <ui:define name="label">USERS</ui:define>
                          <ui:define name="listCaption">User List</ui:define>
                          <ui:define name="input">
                              <h:inputText value="#{backingBean.newFirstUser.name}" readonly="true" size ="40"/>
                          </ui:define>
                           <a:commandLink value="SELECT 1" ajaxSingle="true" reRender="selectUser1"
                                  oncomplete="Richfaces.hideModalPanel('modalPanel')" action="#{backingBean.setNewFirstUser(userRow)}" />
                      </s:decorate>
                     .
                     .
                     .
                      <s:decorate id="selectUser2" template="selectUserTemplate.xhtml">
                          <ui:define name="label">USERS</ui:define>
                          <ui:define name="listCaption">User List</ui:define>
                          <ui:define name="input">
                              <h:inputText value="#{backingBean.newSecondUser.name}" readonly="true" size ="40"/>
                          </ui:define>
                          <a:commandLink value="SELECT 2" ajaxSingle="true" reRender="selectUser2"
                                  oncomplete="Richfaces.hideModalPanel('modalPanel')" action="#{backingBean.setNewSecondUser(userRow)}" />
                      </s:decorate>
      

       

       

      i'm passing the <a:commandLink > parameters <ui:insert/> area of modalPanel.

       

      in my parent panel if i click to selectUser1 link two times my rich:datatable shows me SELECT1 and SELECT2 in order altough i didn't click selectUser2 modalPanels link.

      It is also running backingBean.setNewFirstUser(userRow) and backingBean.setNewSecondUser(userRow) actions in order.

       

      what am i doing wrong??

       

      P.S:sorry for my bad english