My datatable show results, but doesnt filter by protocolo, using JSF works, but promefaces nothing show anything, my code is:
<p:dataTable value="#{registroBean.listarRegistros()}"
var="registro"
widgetVar="registroTable"
id="tabelaRegistro"
class="table table-striped table-hover"
rendered="#{not empty registroBean.listarRegistros()}">
<f:facet name="header">
<p:outputPanel>
<p:inputText id="globalFilter" onkeyup="PF('registroTable').filter()" style="width:100%" placeholder="Digite o protocolo" />
</p:outputPanel>
</f:facet>
<p:column filterBy="{#registro.protocolo}">
<f:facet name="header">Protocolo</f:facet>
<h:outputText value="#{registro.protocolo}" />
</p:column>
</p:dataTable>
When I enter a search return: No records found.
what am I doing wrong?
You should create an empty ArrayList for filtered results in your Managed Bean and set it to your DataTable like this :
<p:dataTable value="#{registroBean.listarRegistros()}"
filteredValue="#{registroBean.filtredRegistro}"
var="registro"
widgetVar="registroTable"
id="tabelaRegistro"
class="table table-striped table-hover"
rendered="#{not emptyregistroBean.listarRegistros()}">
and add this attribut with getter and setter in you RegistroBean
private ArrayList<YourClass> filtredRegistro;
//Getter And Setter
public ArrayList<YourClass> getfiltredRegistro(){
return this.filtredRegistro;
}
public void setfiltredRegistro(filtredRegistro){
this.filtredRegistro=filtredRegistro;
}