Reputation: 3816
as Mentioned in primefaces showcase i am trying to create a global filter for datatable . there i am unable to understand what does carsTable means, in the code fragment
<h:form>
<p:dataTable var="car" value="#{tableBean.carsSmall}"
emptyMessage="No cars found with given criteria">
<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>
when i use my datatableId inplace of carsTable iam getting an javascript error as Undefined Id.
Upvotes: 1
Views: 4207
Reputation: 10463
This looks like a typo in the showcase code display. Their is a missing attribute on the <p:dataTable>
component called widgetVar
. This attribute declares the unique Javascript identifier for this client side component. The code should show this:
<p:dataTable var="car" value="#{tableBean.carsSmall}"
widgetVar="carsTable" emptyMessage="No cars found with given criteria">
...
For some reason the client side function filter()
is not declared in the PF Guide 2.2 under the Client DOM for dataTable, however I know it is there and I use it.
Upvotes: 2