I am trying this example in PrimeFaces. I understand only the first few lines of the code.
<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>
It could display a search box here. The reaming lines of code would be to add the column and populate the columns with data. I don’t understand what
<p:column filterBy="#{car.model}"
headerText="Model" footerText="contains"
filterMatchMode="contains">
<h:outputText value="#{car.model}" />
</p:column>`
What is #{car.model} ? it doesn’t specify anything call model in the java class. How do I alter my java class to make a column display?
The expression variable
caris declared to be thevarattribute of the dataTable. This means that each unique row in the dataTable component can be referenced in expression language by the variablecar.The
modelproperty ofcaris a Bean property of the Serializable POJO Car. It is assumed that the Car class has a propertymodelmeaning a gettergetModel()and a settersetModel().The
filterByattribute of<p:column>specifies that this column header will have its own unique filter text field and that it will filter the rows oncar.modelproperty.The attribute
filterMatchModespecifies that the match criteria iscontainswhich means any textual occurence of what is typed into the column filter field will equate as a matched record. See the Primefaces Guide for a complete list of filterMatchMode options.