本文介绍了如何通过按下按钮刷新 ADF jsf 页面组件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个融合 web 应用程序,它包含一个 af:query 面板(我用表格创建了它的查询面板),以及相互关联的 af:table 和 af:panelFormLayout.当我在查询面板中搜索条目时,结果会同时显示在表格和 panelFormLayout 中.当我按下查询面板中的重置按钮时,只有查询面板被重置.我想重置所有页面.如何利用 ADF 的简易性来做到这一点?

I have a fusion web application that contains an af:query panel (I created it query panel with table), and af:table and af:panelFormLayout that are related with each other. When I search an entry in the query panel results are shown both in table and in panelFormLayout. When I press reset button in the query panel, only the query panel is reset. I want to all the page to reset. How can I do that by using the easiness of ADF?

推荐答案

基本上,您希望覆盖 af:query 的重置功能.在这种情况下,您应该:
1. 将 af:query 的 QueryListener 属性设置为托管 bean 方法.您可以参考此示例,其中描述了所需的所有步骤:以编程方式重置查询面板在它里面,你会看到这个调用:AdfFacesContext.getCurrentInstance().addPartialTarget(t1);它负责表的刷新.现在,如果您在 af:panelGroupLayout 中拥有所有内容(或任何其他支付类型组件),您可以改为刷新它(因此您需要将其与 bean 上的字段绑定并使用它而不是 t1 在此调用中.否则,如果您仍希望刷新整个页面,请按照第 2 步操作.

Basically you want to override the reset functionality of the af:query. In that case, you should:
1. Set the QueryListener property of the af:query to a managed bean method. You can refer to this example which describes all the steps required: Programmatically RESET query panelInside it, you'll see this call: AdfFacesContext.getCurrentInstance().addPartialTarget(t1);It is responsible for the refresh of the table. Now, if you have all the content inside an af:panelGroupLayout for example (or any other payout type component), you can refresh it instead (so you need to bind it with a field on the bean and use it instead of t1 in this call. Otherwise, if you still wish the full page refresh, follow step 2.


2.添加使页面刷新所需的代码:


2. Add the needed code to make the page refresh:

    FacesContext context = FacesContext.getCurrentInstance();
    String currentView = context.getViewRoot().getViewId();
    ViewHandler vh = context.getApplication().getViewHandler();
    UIViewRoot x = vh.createView(context, currentView);
    x.setViewId(currentView);
    context.setViewRoot(x);

只需将其放入上述链接中描述的方法中即可.

Just put it inside the method described on the above link.

这篇关于如何通过按下按钮刷新 ADF jsf 页面组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 23:29