Primefaces selectCheckboxMenu过滤器不起作用而selectOneMenu在数据表内部

时间:2014-05-19 18:59:28

标签: jsf primefaces datatable

我有一个Primefaces(5.0)数据表。我使用两个列过滤器:selectOneMenu(Filter1)和selectCheckboxMenu(Filter2)。

两个过滤器的数据都正常填充。 selectOneMenu(Filter1)可以过滤DataTable,但selectCheckboxMenu(Filter2)在选择值后没有找到任何数据。

JSF

<p:dataTable value="#{employeeBean.employees}" var="employee" id="employeeDTable"
    emptyMessage="No data" filteredValue="#{employeeBean.filteredEmployees}"
    widgetVar="empWidgetVar" rowKey="#{employee.id}">

    <!-- THIS WORKS -->
    <p:column headerText="Filter1" filterBy="truck.id" filterMatchMode="exact">
        <f:facet name="filter">
            <p:selectOneMenu onchange="PF('empWidgetVar').filter()">
                <f:selectItems value="#{dropdowns.trucksWithAllOption}"/>
            </p:selectOneMenu>
        </f:facet>
        <h:outputText value="#{employee.truck.license}"/>
    </p:column>

    <!-- THIS DOESN'T WORK (Doesn't find any data) -->
    <p:column headerText="Filter2" filterBy="truck.id" filterMatchMode="in">
        <f:facet name="filter">
            <p:selectCheckboxMenu onchange="PF('empWidgetVar').filter()" label="Vrachtwagen">
                <f:selectItems value="#{dropdowns.trucksWithAllOption}"/>
            </p:selectCheckboxMenu>
        </f:facet>
        <h:outputText value="#{employee.truck.license}"/>
    </p:column>

</p:dataTable>

dropdowns.trucksWithAllOption

enter image description here

呈现过滤器1

enter image description here

呈现过滤器2

enter image description here

为什么selectCheckboxMenu(Filter2)找不到任何数据而selectOneMenu(Filter1)找不到相同的数据?

0 个答案:

没有答案