I am trying this example ‘DataTable – Filtering’. Everything works except for the Search all fields: textbox that filters. when i enter characters to it it doesn’t filter as in the example.
There is no errors or exceptions thrown. I don’t undestand what onkeyup="carsTable.filter()" does in the code. can someone explain this ? and any idea why it fails to filter
<f:facet name="header">
<p:outputPanel>
<h:outputText value="Search all fields:" />
<p:inputText id="globalFilter" onkeyup="carsTable.filter()" style="width:150px" />
</p:outputPanel>
</f:facet>
carsTableis the name of the datatable. Somehow its missing from the example, but thep:dataTableshould have an attributewidgetVar="carsTable".onkeyupis the event that is firedafter you released a key. It tells thecarsTableto filter after you entered a new character.So add the
widgetVar="carsTable"attribute top:dataTableand you are good to go.If you have a look at the PrimeFaces userguide, you will find the correct example.