PrimeFaces DataTable - 过滤(运行示例的问题) [英] PrimeFaces DataTable - Filtering (problem running the example)
问题描述
我正在尝试此示例在PrimeFaces 。我只理解代码的前几行。
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>`
什么是 {car.model}
?它没有在java类中指定任何调用 model
。
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?
推荐答案
表达式变量 car
The expression variable car
is declared to be the var
attribute of the dataTable. This means that each unique row in the dataTable component can be referenced in expression language by the variable car
.
模型
属性 car
是Serializable POJO Car的Bean属性。假设Car类有一个属性 model
意味着getter getModel()
和setter setModel()
。
The model
property of car
is a Bean property of the Serializable POJO Car. It is assumed that the Car class has a property model
meaning a getter getModel()
and a setter setModel()
.
filterBy
属性>< p:column> 指定此列标题将具有自己唯一的过滤器文本字段,并且将过滤 car.model
属性
The filterBy
attribute of <p:column>
specifies that this column header will have its own unique filter text field and that it will filter the rows on car.model
property.
属性 filterMatchMode
指定匹配条件为包含
这意味着在列过滤器字段中键入的任何文本发生将等于匹配的记录。有关filterMatchMode选项的完整列表,请参阅Primefaces Guide。
The attribute filterMatchMode
specifies that the match criteria is contains
which 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.
这篇关于PrimeFaces DataTable - 过滤(运行示例的问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!