Refresh datatable when performing autocomplete search

0

Good morning everyone .. Could anyone get a question? Good is this, I have a component of primefaces autocomplete and a datatable, however when I perform a autocomplete search, it does not update my datatable, how do I do this?

Below is my autocomplete and my datatable:

<p:autoComplete id="station_select"
   value="#{pmvBean.pmv}"
   completeMethod="#{pmvBean.completePmv}"
   var="pmv" itemValue="#{pmv}"
   itemLabel="#{pmv.location}"
   converter="pmvConverter"
   styleClass="autoComplete-1"
   placeholder="#{bundle['system.msg.history.selectPmv']}" 
   dropdown="true" 
   scrollHeight="500">

</p:autoComplete>

<p:dataTable id="pmv_datatable" value="#{pmvBean.listPmv}"
    widgetVar="pmvDatatable" var="pmv" rowKey="#{pmv.id}"
    sortBy="#{pmv.location}"
    emptyMessage="#{bundle['system.ui.label.emptyDataTable']}"
    style="margin-top: 10px;">
    
asked by anonymous 27.08.2015 / 16:11

1 answer

0

You need to use an ajax to update the dataTable and create a method in your Bean to handle the event:

<p:autoComplete ...atributos...>
  <f:ajax event="itemSelect" 
    listener="#{pmvBean.listenerParaEsseEvento}" render="pmv_dataTable" />
</p:autoComplete>
    
27.08.2015 / 16:18