2

Primefaces 3.5 似乎根本没有从数据表中过滤数据,奇怪的是它会在我键入时以某种方式重新排序它们,因此,肯定有一些 AJAX 调用触发,但显然不是正确的调用。

<h:panelGroup id="table-wrapper-component">
            <prime:dataTable
                rendered="#{artifactSelectionBackingBean.visibleComps}"
                value="#{artifactSelectionBackingBean.components}"
                var="tagInfoObject" emptyMessage="No tags found with given criteria"
                filteredValue="#{artifactSelectionBackingBean.filteredComponents}">

                <prime:ajax event="filter" global="false" />

                <prime:column sortBy="#{tagInfoObject.tagId}"
                    headerText="Identifier" filterMatchMode="contains" filterBy = "#{tagInfoObject.tagId}">
                    <h:outputText value="#{tagInfoObject.tagId}" />
                </prime:column>

                <prime:column sortBy="#{tagInfoObject.type.tagTypeId}"
                    headerText="Tag Identifier" filterMatchMode="contains" filterBy ="#{tagInfoObject.type.tagTypeId}"> 
                    <h:outputText value="#{tagInfoObject.type.tagTypeId}" />
                </prime:column>

                <prime:column sortBy="#{tagInfoObject.title}" headerText="Title" filterMatchMode="contains" filterBy="#{tagInfoObject.title}">
                    <h:outputText value="#{tagInfoObject.title}" />
                </prime:column>

                <prime:column filterBy="#{tagInfoObject.description}"
                    filterMatchMode="contains" sortBy="#{tagInfoObject.description}"
                    styleClass="wrap" headerText="Component Description">
                    <h:outputText value="#{tagInfoObject.description}" />
                </prime:column>

            </prime:dataTable>
        </h:panelGroup>

任何帮助表示赞赏!所有 Bean 和方法调用都存在并返回适当的数据,只是过滤似乎根本不起作用。

另外,请注意排序功能正确只有过滤没有!

4

2 回答 2

3

问题是您总是需要将任何过滤/排序属性包装在带有h:form标签的数据表中。这在 PrimeFaces 的文档中没有明确指定,但是,它在此处的展示中。我将整个东西包装在表单标签中。

因此,如果您想要 primefaces 提供的任何类型的交互,请不要忘记将您的数据表包装在一个表单中。

于 2013-10-09T15:08:51.923 回答
0

您的托管 Bean 代码会很好地发布您的托管 bean 代码。

可能是您没有在托管 bean 中设置artifactSelectionBackingBean.filteredComponents的值

于 2013-10-08T09:06:36.297 回答