0 Replies Latest reply on Apr 26, 2012 11:14 AM by jgromero

    rich:extendedDataTable selection inside a component

    jgromero

      Hi,

       

      I have a composite component that shows a rich:popupPanel when a button is clicked. Then, inside the rich:popupPanel I perform a search, that is shown in a rich:extendedDataTable. So far, everything seems to work. Finally, I have to be able to double click one row in the table and the row double-clicked should be selected and rendered in the field's values of the component.

       

      The problem is that when I double click, the first time the rich:popupPanel is correctly hidden, the bean is actually updated, but the fields in the component do not show the update. However, if I open again the rich:popupPanel, and selects the same row, the field's values of the component are updated and showed correctly.

       

      Here I show the most relevant parts of source code:

       

      The component:

       

      {code:xml}

      <composite:implementation>

           <a4j:region renderRegionOnly="true">

                <rich:panel header="${messages_emision['tomadores.titulo']}" id="panelTomador">

                     <h:inputText id="nombres" readonly="#{!cc.attrs.esCotizacion}"

                               value="#{cc.attrs.tomador.nombres}"/>

                     <a4j:commandLink execute="@this"

                               oncomplete="#{rich:component('buscarTerceroPanel')}.show()">

                          <img src="#{facesContext.externalContext.requestContextPath}/resources/images/find.png"

                                    border="0" width="14" height="14" alt="Buscar"/>

                     </a4j:commandLink>

                </rich:panel>

           </a4j:region>

       

           <rich:popupPanel header="${messages_emision['tercero.busqueda.titulo']}"

                     id="buscarTerceroPanel" domElementAttachment="form" width="700" height="340">

                <a4j:outputPanel layout="block" id="panelBusqueda" ajaxRendered="true">

                     <h:inputText id="documento" value="#{terceroMB.documento}"/>

                     <a4j:commandButton id="siguiente" value="${messages['comun.buscar']}"

                               action="#{terceroMB.buscar}" execute="panelBusqueda" render="panelBusqueda"/>

                     <rich:extendedDataTable value="#{terceroMB.listaTerceros}" var="terceroIter"

                               id="listaTerceros" selectionMode="single" selection="#{terceroMB.seleccionado}">

                          <a4j:ajax execute="@this" event="rowdblclick" render="panelTomador"

                                    oncomplete="#{rich:component('buscarTerceroPanel')}.hide();"/>

                          <rich:column>

                               <f:facet name="header">${messages_emision['tercero.nombre']}</f:facet>

                               <h:outputText value="#{terceroIter.nombreCompleto}" />

                          </rich:column>

                     </rich:extendedDataTable>

                </a4j:outputPanel>

           </rich:popupPanel>

      </composite:implementation>

      {code}

      The bean:

       

      {code:java}

      @ViewScoped

      @Named("terceroMB")

      public class TerceroMB {

       

           private Tomadores tomador;

       

           public Object getSeleccionado() {

                if (seleccionado != null){

                     Iterator<Integer> iterator = ((HashSet<Integer>)seleccionado).iterator();

                     while (iterator.hasNext()){

                          Integer index = iterator.next();

                          tomador = (Tomadores) this.listaTerceros.get(index);

                     }

                }

           }

      ...

      }

      {code}

      I've search through the web, and performed several different approaches, but I didn't found the reason for this to happen.