1

I've been trying to update a table of data via AJAX with a CommanButton, and tried with many answers here but none of them has worked, that more has come not update the table until when the tab is closed and opened again. My code is this:

  <h:body >
    <p:layout fullPage="true" >  
        <p:layoutUnit position="west" size="300" header="Criterios de busqueda" resizable="true" closable="true" collapsible="true" >  
            <h:form id="form2">               
                <h:panelGrid columns="1" cellpadding="5">  
                    <h:outputText value="Gestión" />  
                    <p:selectManyMenu id="basic" value="#{busquedaController.selectVisita}"   style="width: 200px;">  
                        <f:selectItem itemLabel="Vacio" itemValue="vacio" />
                        <f:selectItem itemLabel="Entrevista" itemValue="Option1" />  
                        <f:selectItem itemLabel="Inscripción" itemValue="Option2" />  
                        <f:selectItem itemLabel="Cotización" itemValue="Option3" /> 
                        <f:selectItem itemLabel="Orden de Pedido" itemValue="Option4" />  
                        <f:selectItem itemLabel="Facturación" itemValue="Option5" />  
                        <f:selectItem itemLabel="Entrega de Pedido" itemValue="Option6" />  
                        <f:selectItem itemLabel="Cobro" itemValue="Option7" />  
                        <f:selectItem itemLabel="Garantia" itemValue="Option8" />  
                        <f:selectItem itemLabel="Cambio" itemValue="Option9" />  
                        <f:selectItem itemLabel="Productos por Cotizaciones" itemValue="Option10" />  
                        <f:selectItem itemLabel="Productos por Orden de pedido" itemValue="Option11" /> 
                        <f:selectItem itemLabel="Productos por Facturaciones" itemValue="Option12" />  
                        <f:selectItem itemLabel="Productos por Entrega de Pedido" itemValue="Option13" />  
                        <f:selectItem itemLabel="Productos por Cobro" itemValue="Option14" />  
                        <f:selectItem itemLabel="Productos por Garantia" itemValue="Option15" />  
                        <f:selectItem itemLabel="Productos por Cambio" itemValue="Option16" /> 
                    </p:selectManyMenu>   
                    <h:outputLabel for="idcliente" value="Id Cliente:"/>
                    <p:inputText  id="idcliente"  label="idadmins" value="#{busquedaController.cliente}"/>
                    <h:outputLabel for="idvendedor" value="Id Vendedor:"/>
                    <p:inputText  id="idvendedor"  label="idadmins" value="#{busquedaController.vendedor}"/>
                    <h:outputLabel for="consulta" value="Id Producto:"/>
                    <p:inputText value="#{busquedaController.pConsulta}" id="consulta" label="consulta" />  
                    <h:outputLabel value="Desde:"/>
                    <p:calendar required="true" effect="drop" id="startDate" value="#{busquedaController.desde}" pattern="dd/MM/yy" requiredMessage="El campo Desde es obligatorio">
                    </p:calendar> 
                    <h:outputLabel for="" value="Hasta:"/>
                    <p:calendar required="true" effect="drop" id="endDate" value="#{busquedaController.hasta}" pattern="dd/MM/yy" requiredMessage="El campo Hasta es obligatorio" >                        
                    </p:calendar>    
                    <p:commandButton value="Buscar" action="#{busquedaController.update_result()}" update=":entrevista" >
                    </p:commandButton>  
                    <p:messages />
                </h:panelGrid>     
            </h:form> 
        </p:layoutUnit>  
        <p:layoutUnit position="center" header="Resultados" >  
            <p:panel  style=" width: 100%" id="panel">
                <p:dataTable value="#{busquedaController.result}" id="entrevista" var="item">
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Id de la entrevista"/>
                        </f:facet>
                        <h:outputText value="#{item.identrevista}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Id del cliente"/>
                        </f:facet>
                        <h:outputText value="#{item.idcliente}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="id del vendedor"/>
                        </f:facet>
                        <h:outputText value="#{item.idvendedor}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Fecha"/>
                        </f:facet>
                        <h:outputText value="#{item.fecha}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Posicion"/>
                        </f:facet>
                        <h:outputText value="#{item.posicion}"/>
                    </p:column>
                </p:dataTable>
            </p:panel>  
        </p:layoutUnit>  
    </p:layout>  
</h:body>  

when I use :panel:entrevista i get a error , the page doesn't find the panel, so I just tried with :entrevista and is working but not mmdiate. When I use ajax="false", is working but ofcourse that update whole page. I just need update that part of the page. Can anyone help me?

Jorge
  • 238
  • 1
  • 10

0 Answers0