OAF中实现两个下拉选择框的联动

步骤:
1.创建两个VO:ReportTypeVO和ReportVO(ReportVO中的ReportTypeId与ReportTypeVO中的ReportTypeId相关);将两个VO添加到AM中,其Instance Name分别为:ReportTypeVO1和ReportVO1;
2.在页面中创建两个item,Item Style为messageChoice,ID分别为:ParentChoice和ChildChoice,其Picklist View Instance属性分别与第一步的ReportTypeVO和ReportVO相关联;指定各自的Picklist Display Attribute和Picklist Value Attribute属性;
3.设置ParentChoice的Action Type为fireAction,Event为changeList;
4.在CO.java中的processRequest()中处理ChildChoice列表初始化(初始列表值为空):
OAApplicationModule am =
(OAApplicationModule)pageContext.getApplicationModule(webBean);
am.invokeMethod("handleListInitEvent");
5.在AMImpl.java中:
public void handleListInitEvent()
{
ReportVOImpl vochild = (ReportVOImpl)findViewObject("ReportVO1");
vochild.initQuery(new Number(-1));//页面初始化,ParentChoice未选择值,ChildChoice值列表应为空
}
6.在CO.java中的processFormRequest()中处理ParentChoice的数据变化事件:
import oracle.apps.fnd.framework.webui.beans.message.OAMessageChoiceBean;
if ("changeList".equals(event))
{
OAMessageChoiceBean parentChoiceBean
= (OAMessageChoiceBean)webBean.findChildRecursive("ParentChoice");

String selectValue = parentChoiceBean.getSelectionValue(pageContext);
Serializable[] parameters = { selectValue };
am.invokeMethod("handleListChangeEvent",parameters);
}
7.在AMImpl.java中:
 public void handleListChangeEvent(String selectValue)
{
Number reportTypeId = null;
try
{
reportTypeId = new Number(selectValue);
}
catch(Exception e){}

ReportVOImpl vochild = (ReportVOImpl)findViewObject("ReportVO1");
vochild.initQuery(reportTypeId);
}

8.在ReportVOImpl.java中:

public void initQuery(Number reportTypeId)
{
setWhereClause("REPORT_TYPE_ID = :1");
setWhereClauseParams(null); // Always reset
setWhereClauseParam(0, reportTypeId);
executeQuery();
}

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/1702453/viewspace-903600/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/1702453/viewspace-903600/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值