应用过滤器后,Primefaces数据表尚未刷新

时间:2015-01-15 05:05:28

标签: jsf-2 primefaces datatable

我有一些代码类似于以下展示:

http://www.primefaces.org/showcase/ui/data/datatable/filter.xhtml

尽管数据表尚未使用新过滤的行进行刷新,但过滤器仍在辅助bean中正确应用。它在应用过滤器之前保持原样。这个展示中是否有遗漏或错误的东西?

        <h:form>
        <p:dataTable var="serviceEntity" value="#{serviceSearchMB.allServices}" widgetVar="serviceSearchTable"
            emptyMessage="No services found with given criteria" filteredValue="#{serviceSearchMB.filteredServices}">

            <f:facet name="header">

                    <h:outputText value="Search all fields:" />
                    <p:inputText id="globalFilter" onkeyup="PF('serviceSearchTable').filter();"
                        style="width:150px" placeholder="Enter keyword" />

            </f:facet>


            <p:column filterBy="#{serviceEntity.serviceName}" headerText="Service Name" filterMatchMode="contains" >

                <h:outputText value="#{serviceEntity.serviceName}" />
            </p:column>
...

支持Bean:

@ManagedBean(name="serviceSearchMB")
@RequestScoped
public class ServiceSearchManagedBean implements Serializable {
    private List<ServiceSearchEntity> filteredServices;


    public List<ServiceSearchEntity> getFilteredServices() {
        return filteredServices;
    }


    public void setFilteredServices(List<ServiceSearchEntity> filteredServices) {
        this.filteredServices = filteredServices; // Already set the filtered list correctly.
    }

    public List<ServiceSearchEntity> getAllServices() {
        //already returns all services.
    }
...

0 个答案:

没有答案