6 Replies Latest reply on Jan 31, 2011 4:05 PM by Celeste Ormaechea

    DataTable with filter and modalpanel

    Celeste Ormaechea Newbie

      Hi! I have a problem trying to implement a datatable with sorting and filter, so I can find a client in my table (by a number or surname). But I need to modify this client, so I use modal Panel to show this information and edit. This modalpanel works If I dont use filtering, but if I look for a client in particular, it doesnt work, and my model panel doesnt show.

      What could be the problem? Here is my code.

       

      Best regards,

      Maria Celeste.

       

       

      <a4j:region>

                                      <h:form>                      

                    <rich:dataTable  value="#{BeanSesion.clientes}" var="cliente" id="clientes" width="650" rows="5"

                                           style="border-style:outset;border-width:medium;" reRender="scroller">

                       <rich:column sortable="true" sortBy="#{cliente.nro_cliente}" label="NºCliente" id="col1" filterBy="#{cliente.nro_cliente}" filterEvent="onkeyup" width="100px">

                                                        <f:facet name="header">

                                                            <h:outputText value="NºCliente" id="txtcliente"/>

                                                        </f:facet>

                                                        <h:outputText value="#{cliente.nro_cliente}" id="nro"/>

                       </rich:column>

                               <rich:column sortable="true" sortBy="#{cliente.apellido}" id="col2" filterBy="#{cliente.apellido}" filterEvent="onkeyup" width="100px" label="Apellido">

                                <f:facet name="header">

                                                            <h:outputText value="Apellido" id="txtApellido"/>

                                                        </f:facet>

                                                        <h:outputText value="#{cliente.apellido}" id="apellido"/>

                                                    </rich:column>

                                                              <rich:column id="col3" width="100px" label="Nombre">

                                                        <f:facet name="header">

                                                            <h:outputText value="Nombre" id="txtnombre"/>

                                                        </f:facet>

                                                        <h:outputText value="#{cliente.nombre}" id="nombre"/>

                                                    </rich:column>

                                                    <rich:column id="col4" width="100px" label="DNI">

                                                        <f:facet name="header">

                                                            <h:outputText value="DNI" id="txtdni"/>

                                                        </f:facet>

                                                        <h:outputText value="#{cliente.dni}" id="dni"/>

                                                    </rich:column>

                                                    <rich:column id="col5" width="150px" label="Domicilio">

                                                        <f:facet name="header">

                                                            <h:outputText value="Domicilio" id="txtdomicilio"/>

                                                        </f:facet>

                                                        <h:outputText value="#{cliente.domicilio}" id="domicilio"/>

                                                    </rich:column>

                                                    <rich:column id="col6" label="Fecha Nacimiento">

                                                        <f:facet name="header">

                                                            <h:outputText value="Fecha Nacimiento" id="txtfecha"/>

                                                        </f:facet>

                                                        <h:outputText value="#{cliente.fecha_nac}" id="fecha"/>

                                                    </rich:column>

                                                     <rich:column id="col7" label="Acciones">

                                                                <f:facet name="header">

                                                            <h:outputText value="Acciones" id="txtacc"/>

                        </f:facet>

                        <a4j:commandLink ajaxSingle="true" id="editarlink" oncomplete="#{rich:component('panelEditar')}.show()">

                                                                      <h:graphicImage value="/img/editar.bmp" style="border:0" />

                                                                      <f:setPropertyActionListener value="#{cliente}"

                                                                          target="#{BeanSesion.seleccion}" />

                                                              </a4j:commandLink>

                                                              <rich:toolTip for="editarlink" value="Editar" />

                                                    </rich:column>

                                                    <f:facet name="footer">

                                                        <rich:datascroller id="scroller" renderIfSinglePage="false" maxPages="5" />

                                                    </f:facet>

                                                            </rich:dataTable>

                                                            </h:form>

       

                                                              <h:form>

                                                            <rich:modalPanel id="panelEditar" autosized="true" width="450">

                                                                <f:facet name="header">

                                                                              <h:outputText value="Modificar datos del Cliente" />

                                                                </f:facet>

                                                                          <f:facet name="controls">

                                                                              <h:panelGroup>

                                                                                  <h:graphicImage value="/img/cerrar.bmp" id="hidelink"

                                                                                      styleClass="hidelink" />

                                                                                  <rich:componentControl for="panelEditar" attachTo="hidelink"

                                                                                      operation="hide" event="onclick" />

                                                                              </h:panelGroup>

                                                                          </f:facet>                                     

                                                                              <rich:messages style="color:red;"></rich:messages>

                                                                              <h:panelGrid columns="1">

                                                                                  <a4j:outputPanel ajaxRendered="true">

                                                                                             <h:panelGrid columns="3">

                                                                                               <h:outputText value="Apellido" />

                                                                                          <h:inputText id="apellido" value="#{BeanSesion.seleccion.apellido}" required="true">

                                                                                                    <f:validateLength  minimum="3" maximum="45" />

                                                                                          </h:inputText>

                                                                                          <rich:message for="apellido" style="color: red;" />

                                                                                          <h:outputText value="Nombre" />

                                                                                          <h:inputText id="nombre" value="#{BeanSesion.seleccion.nombre}" required="true" >

                                                                                                    <f:validateLength  minimum="3" maximum="45" />

                                                                                          </h:inputText>

                                                                                          <rich:message for="nombre" style="color: red;" />

                                                                                          <h:outputText value="DNI" />

                                                                                          <h:inputText id="dni"  value="#{BeanSesion.seleccion.dni}" required="true">

                                                                                                    <f:validateLength minimum="6" maximum="8"></f:validateLength>

                                                                                          </h:inputText>

                                                                                          <rich:message for="dni" style="color: red;" />

                                                                                          <h:outputText value="Domicilio" />

                                                                                          <h:inputText id="domicilio" value="#{BeanSesion.seleccion.domicilio}" required="false">

                                                                                                    <f:validateLength  minimum="5" maximum="60" />

                                                                                           </h:inputText>

                                                                                          <rich:message for="domicilio" style="color: red;" />

                                                                                </h:panelGrid>                                                           

                                                                                  </a4j:outputPanel>

                                                                                  <a4j:commandButton value="Guardar"

                                                                                      action="#{BeanSesion.modificar}"

                                                                                      reRender="nombre,apellido,dni,domicilio"

                                                                                      oncomplete="if (#{facesContext.maximumSeverity==null}) #{rich:component('panelEditar')}.hide();" />

                                                                              </h:panelGrid>                                                                                                                                           

                                                                      </rich:modalPanel>

                                                                      </h:form>                                                                                                 

                                                  </h:panelGrid>

                                        </rich:panel>

                                        </a4j:region>