简体   繁体   English

根据ADF中的自定义Pojo列表在af:table上应用过滤器

[英]Applying filter on af:table based on a custom Pojo list in ADF

I am using af:table component in a Report functionality in an ADF page. 我在ADF页面的报表功能中使用af:table组件。

My entire report data comes from a third party service. 我的整个报告数据来自第三方服务。

This service accept some search criteria entred by user in report page. 该服务接受用户在报告页面中输入的一些搜索条件。

After entring the search criteria when user clicks search button service gets invoked and data is rendered in Table. 在用户单击搜索按钮时调用搜索条件后,将调用服务并在表中呈现数据。

Now,I need to enable filtering in some of my table columns. 现在,我需要在某些表列中启用过滤。 Applying filtering is very easy in case of VO based table.But since data is comming from service I had custom Pojo List VO based表的情况下应用过滤非常容易。但是由于数据来自服务我有自定义Pojo列表

        <af:table scrollPolicy="page" autoHeightRows="8" value="#{myBean.pojoList}" var="myreport" id="t1"
               styleClass="AFStretchWidth" filterVisible="true">

                <af:column headerText="Header1" width="10%" filterable="true">
                      <f:facet name="header">
                         <af:inputText simple="true" value="#{myBean.filterInput1}" autoSubmit="true" valueChangeListener="#{mybean.method}"/> 
                      </f:facet>
                      <af:outputText value="#{myreport.data}"/>
                    </af:column>

                <!--other columns -->   
      <af:table>

Although input box appearing in column header but it is comming in readonly mode.I am not able to enter anything.[ valueChangeListener holds the filtering logic ] 虽然input box出现在列标题中但它以只读模式进行。我无法输入任何内容。[ valueChangeListener保存过滤逻辑 ]

I tried with <f:facet name="filter"> but it also yields same output ie a readonly input box. 我尝试使用<f:facet name="filter">但它也会产生相同的输出, 即只读输入框。

I have getters and setters both in my managed bean still it appears in readonly mode. 我在托管bean中都有getter和setter,它仍以只读模式显示。

can anyone suggest why it is rendering in readonly mode? 有人可以建议为什么它以只读模式呈现吗? Is there any other way for achieving filtering without using VO Based Table? 是否有其他方法可以在不使用基于VO的表的情况下实现过滤?

尝试使用构面名称作为“过滤器”而不是“标题”。

You first need to create a data control for the bean , after drag and drop that as table then filter model will get created and then you will be able customize the filters. 首先,需要为bean创建一个数据控件,将其拖放为表格后,将创建过滤器模型,然后可以自定义过滤器。

Search region Will be created as shown below 搜索区域将如下所示创建

在此输入图像描述

And your table uses it like below 你的表使用它如下

在此输入图像描述

You can download the sample application for reference from below link 您可以从以下链接下载示例应用程序以供参考

https://www.dropbox.com/s/1mmengkmx98kmnq/pojo1.zip?dl=0 https://www.dropbox.com/s/1mmengkmx98kmnq/pojo1.zip?dl=0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM