使用Choice List 实现查询
来源:互联网 发布:淘宝网高腰半身a字裙 编辑:程序博客网 时间:2024/05/22 15:38
运行环境:JDeveloper 11.1.2.2.0 + Oracle Database 10g Express Edition 10.2.0.1。
本实验来自于客户实际需求:使用Choice List作为查询条件,显示名称,保存ID。
重要步骤说明:
1. 手工创建两个VO,一个用于显示查询结果,一个用于显示查询条件
(1)EmployeesByManagerIdView,作为查询结果显示
SELECT * FROM employees WHERE manager_id = : bv_managerId
(2)ManagersHasEmployeesView,作为查询条件显示
SELECT DISTINCT manager_id,last_name FROM employees WHERE manager_id IS NOT NULL ORDER BY manager_id
2. 创建页面,拖放bv_managerId到页面,选择Select One Choice。
(1)
(2)
(3)点击List Data Source 旁边的Add按钮
(4)选择ManagersHasEmployeesView作为List Data Source,设置返回字段和显示字段。
(5)设计页面显示效果如下:
(6)点击Binding Tab,点击ExecuteWithParams,会发现参数bv_managerId已经绑定到了Choice List组件的值:
3. 修改Choice List,增加ValueChangeListener,隐藏Button
(1)修改后页面代码如下:
<af:form id="f1"> <af:selectOneChoice value="#{bindings.bv_managerId.inputValue}" label="#{bindings.bv_managerId.label}" required="#{bindings.bv_managerId.hints.mandatory}" shortDesc="#{bindings.bv_managerId.hints.tooltip}" valueChangeListener="#{myBackingBean.managerValueChangeListener}" autoSubmit="true" id="soc1"> <f:selectItems value="#{bindings.bv_managerId.items}" id="si1"/> </af:selectOneChoice> <af:commandButton actionListener="#{bindings.ExecuteWithParams.execute}" text="ExecuteWithParams" disabled="#{!bindings.ExecuteWithParams.enabled}" visible="false" id="cb1"/> <af:table rows="#{bindings.EmployeesByManagerIdView1.rangeSize}" fetchSize="#{bindings.EmployeesByManagerIdView1.rangeSize}" emptyText="#{bindings.EmployeesByManagerIdView1.viewable ? 'No data to display.' : 'Access Denied.'}" var="row" rowBandingInterval="0" value="#{bindings.EmployeesByManagerIdView1.collectionModel}" selectedRowKeys="#{bindings.EmployeesByManagerIdView1.collectionModel.selectedRow}" selectionListener="#{bindings.EmployeesByManagerIdView1.collectionModel.makeCurrent}" rowSelection="single" id="t1" partialTriggers="::cb1" styleClass="AFStretchWidth"> <af:forEach items="#{bindings.EmployeesByManagerIdView1.attributeDefs}" var="def"> <af:column headerText="#{bindings.EmployeesByManagerIdView1.labels[def.name]}" sortable="true" sortProperty="#{def.name}" id="c1"> <af:outputText value="#{row[def.name]}" id="ot1"/> </af:column> </af:forEach> </af:table></af:form>
(2)Managed Bean代码:
public void managerValueChangeListener(ValueChangeEvent valueChangeEvent) { BindingContainer bindings = getBindings();// JUCtrlListBinding listBinding = null;// listBinding = (JUCtrlListBinding)bindings.get("bv_managerId");// ViewRowImpl selectedListRow = null;// selectedListRow = (ViewRowImpl)listBinding.getSelectedValue();// Integer selectedManagerId = (Integer)selectedListRow.getAttribute("ManagerId");// String selectedLastName = (String)selectedListRow.getAttribute("LastName");// System.out.println("################ selectedManagerId " + selectedManagerId);// System.out.println("################ selectedLastName " + selectedLastName); OperationBinding operationBinding = bindings.getOperationBinding("ExecuteWithParams");// operationBinding.getParamsMap().put("bv_managerId", selectedManagerId); Object result = operationBinding.execute(); if (!operationBinding.getErrors().isEmpty()) { // ignore } }
4. 运行效果
Project 下载:ADF_LOV_Query_ChoiceList.7z
http://maping930883.blogspot.com/2012/08/adf185choice-list.html
0 0
- 使用Choice List 实现查询
- 使用Choice List 实现LOV
- list-choice
- List<> 实现模糊查询
- CHOICE
- Choice
- choice
- 2E01-View-Lists-single -choice-list
- 2E02-View-Lists-multiple -choice-list
- jdbcTemplate 实现查询返回list
- BAT批处理中choice的使用示例
- Jenkins: Dynamic Choice Parameter get all branch list of git
- IbatisNet的LIST遍历实现模糊查询
- Mybatis List列表In查询实现
- IReport使用List参数做多值查询
- jdbctemplate 使用多表查询List
- 使用DataReader实现查询
- list使用与简单实现
- 图片格式及内存占用
- POJ 2387 Til the Cows Come Home
- 使用Input Text with LOV + Transient Attribute 实现显示名称保存ID
- 黑马程序员----IOS笔记 #pragma mark的用法
- POJ3525-Most Distant Point from the Sea(二分+半平面交)
- 使用Choice List 实现查询
- Libgdx的使用(16)——内存管理和对象池
- Linux bash shell 逐行读取文件的三种方法
- 元数据驱动
- [小技巧] 快速给目录打包
- c++:array
- 使用ReturnPopupListener接收Input Text with LOV的返回值
- python下的MySQLdb使用
- Ios小新ui开发日志