小编Fer*_*enc的帖子

Primefaces数据表过滤器不起作用

我必须做一些根本错误的事情,我用数据表将代码剥离到最低限度并启用一个列过滤器和一个全局过滤器.

有趣的是,Primefaces的示例代码有效.与我的代码唯一的区别应该是它从数据库中收集数据而不是在bean中生成数据.

我没有更多的线索,为什么我的例子没有做任何事情当我在过滤器中输入一些东西时会感激这里的任何想法.

我的xhtml:

    <!DOCTYPE html>
<html xmlns="http://www.w3c.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui">

<ui:composition template="layout.xhtml">

    <ui:define name="title">All Projects</ui:define>    

    <ui:define name="content">


        <p:dataTable var="project" value="#{projectController.allProjects}" widgetVar="projectTable" filteredValue="#{projectController.filteredProjects}">

            <f:facet name="header">
                <p:outputPanel>  
                    <h:outputText value="Search all fields:" />  
                    <p:inputText id="globalFilter" onkeyup="PF('projectTable').filter()" style="width:150px" />  
                </p:outputPanel>
            </f:facet>

            <p:column headerText="Name" filterBy="#{project.name}">
                <h:outputText value="#{project.name}" />
            </p:column>

            <p:column headerText="Priority">
                <h:outputText value="#{project.priority}" />
            </p:column>

            <p:column headerText="Exit">
                <h:outputText value="#{project.exitCriteria}" />
            </p:column>

        </p:dataTable>      

    </ui:define>
</ui:composition>
Run Code Online (Sandbox Code Playgroud)

我的豆子:

    package com.apa.projectd.common;
    import java.io.Serializable;
    import java.util.List;
    import javax.annotation.PostConstruct;
    import javax.enterprise.context.SessionScoped;
    import javax.faces.bean.ManagedBean;
    import javax.inject.Inject;
    import com.habony.common.Loggable;
    import com.habony.projectd.ejbs.ProjectEJB; …
Run Code Online (Sandbox Code Playgroud)

datatable filter primefaces

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

datatable ×1

filter ×1

primefaces ×1