Java Can';无法在PrimeFaces数据表上进行筛选
DataTable没有使用primefaces 4.0筛选我,我想筛选Estado字段Java Can';无法在PrimeFaces数据表上进行筛选,java,jsf,primefaces,Java,Jsf,Primefaces,DataTable没有使用primefaces 4.0筛选我,我想筛选Estado字段 <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.or
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body>
<h:form>
<p:dataTable var="persona" value="#{filtroBean.lstPersona}" widgetVar="lstPersona"
emptyMessage="No cars found with given criteria" filteredValue="#{filtroBean.lstPersonaFiltro}">
<f:facet name="header">
<p:outputPanel>
<h:outputText value="Search all fields:" />
<p:inputText id="globalFilter" onkeyup="PF('lstPersona').filter()" style="width:150px" placeholder="Enter keyword"/>
</p:outputPanel>
</f:facet>
<p:column filterBy="#{filtroBean.getEstado(persona.estado)}" headerText="Estado" footerText="contains" filterMatchMode="contains">
<h:outputText value="#{filtroBean.getEstado(persona.estado)}" />
</p:column>
</p:dataTable>
</h:form>
<br />
</h:body>
</html>
请指导我实现目标的正确方法
<p:column filterBy="#{filtroBean.getEstado(persona.estado)}" headerText="Estado" footerText="contains" filterMatchMode="contains">
在getEstado中,返回字符串“Ninguno”,并且Ninguno不是属性
<p:column filterBy="#{persona.estado}" .....>
为了将int映射到字符串,您需要编写一个转换器,在PF5中,您可以使用p:column中的filterFunction
<p:column filterBy="#{filtroBean.getEstado(persona.estado)}" headerText="Estado" footerText="contains" filterMatchMode="contains">
public class foo {
private String filterMe;
//getter and setter
}
<p:column filterBy="#{persona.estado}" .....>