2 Replies Latest reply on Jun 3, 2010 10:37 AM by ilya_shaikovsky

    a4j:commandButton x rich:modalPanel

    edilmar

      Hi,

       

      I have a webapp with some filter fields and a button to process the filters and to fill a rich:dataTable. The rich:dataTable has a column with a link to show a rich:modalPanel with details of the database record. If I use h:commandButton, when I click the details link, all works fine, but with a4j:commandButton, the modalPanel with details appears but JSF makes a new call to the form, clearing the filters and the dataTable.

       

      Here is my code:

       

              <a4j:form>
              <rich:spacer width="0" height="10"/>
              <a4j:commandButton id="consultar" value="#{msgBotoes['labelConsultar']}"
                                 action="#{consViagensCliente.consultar}" reRender="table"/>
              <rich:spacer width="10" height="0"/>
              <h:commandButton id="limpar" value="#{msgBotoes['labelLimpar']}" 
                               action="#{consViagensCliente.limpar}" reRender="table"/>
              <rich:messages id="messages" layout="list"/>
      
              <a4j:status onstart="#{rich:component('splash')}.show()" onstop="#{rich:component('splash')}.hide()" />
              <rich:modalPanel id="splash" autosized="true" width="200" height="80" moveable="false" resizeable="false">
                <f:facet name="header"><h:outputText value="#{msgGeral['splash.titulo']}" /></f:facet>
                <h:outputText value="#{msgGeral['splash.msg']}" />
              </rich:modalPanel>
              </a4j:form>
      
              <p>
                <rich:dataTable id="table" rows="#{login.maxResultPagina}"
                                onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
                                onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
                                cellpadding="0" cellspacing="0"
                                border="0" var="item" rowKeyVar="rowListTable"
                                value="#{consViagensCliente.listTable}"
                                rendered="#{consViagensCliente.listTable != null}"
                                >
                  <rich:column width="0px" id="indice" styleClass="alignCenter">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="" /></f:facet>
                    <h:outputLabel value="#{rowListTable+1}" />
                  </rich:column>
                  <rich:column width="60px" id="numConhecimento" styleClass="alignCenter">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="#{msgCliente['consViagens.table.labelNumConhec']}" /></f:facet>
                    <f:subview id="detailViagem"
                               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:a4j="http://richfaces.org/a4j"
                               xmlns:rich="http://richfaces.org/rich">
                      <rich:modalPanel id="panel" width="800" height="550">
                        <f:facet name="header">
                          <h:panelGroup>
                            <h:outputText value="#{msgCliente['labelTituloDetViagem']}"></h:outputText>
                          </h:panelGroup>
                        </f:facet>
                        <f:facet name="controls">
                          <h:panelGroup>
                            <rich:componentControl for="panel" attachTo="hidelink" operation="hide" event="onclick"/>
                            <h:outputLink value="#" id="hidelink">[#{msgBotoes['labelFechar']}]</h:outputLink>
                          </h:panelGroup>
                        </f:facet>
                        ... <!-- rest of the code for modalPanel -->
                      </rich:modalPanel>
                      <h:outputLink value="#" id="link">
                        #{item.numConhec}
                        <rich:componentControl for="panel" attachTo="link" operation="show" event="onclick"/>
                      </h:outputLink>
                    </f:subview>
                  </rich:column>
                  ... <!-- rest of the code for dataTable -->
      
      

       

      I need to use a4j button and not h button because I use a splash screen for the user to know that the search is been done at this time.

      But, the splash is not the problem, because if I comment it, the poor behaviour of a4j is the same.

       

      Then, I think this is a problem with a4j:commandButton and modalPanel.