selectOneChoice table filter for LOV column

In this post I am going to show how to add a selectOneChoice component as a filter for a column with LOV.

When displaying data into tables and using the out-of-the-box filtering feature, you might want for a column with list of values attribute to also have that list of values in the filter section.

The demo application is built on hr schema and considered we have already built the Model project with business components for Employees and Departments, and the EmployeesVO has a LOV on DepartmentId attribute.

In the ViewController project we then create a new jspx page, employees.jspx and add the employees table from DataControl -> EmployeesVO with Filtering option checked.

To add the data model behind the selectOneChoice filter we intend to put into the department column, we select the Bindings tab for employees page and add a new binding in the Bindings box. Select ‘tree’ in the next window of the create binding wizzard and then fill in the data as in the following screenshot:


In the Source tab of employee page, we add the filter facet for the department column (lines 5-14):



< af:column sortProperty = "DepartmentId" filterable = "true"
            sortable = "false"
            headerText = "#{bindings.EmployeesVO.hints.DepartmentId.label}"
            id = "c4" width = "150" >
   < f:facet name = "filter" >
     < af:selectOneChoice value = "#{vs.filterCriteria.DepartmentId}"
                         label = "Dep" unselectedLabel = "" id = "soc2" >
       < af:forEach items = "#{bindings.DepartmentsVO.rangeSet}"
                   var = "item" >
         < f:selectItem id = "si2" itemLabel = "#{item.DepartmentName}"
                       itemValue = "#{item.DepartmentId}" />
       </ af:forEach >
     </ af:selectOneChoice >
   </ f:facet >
   < af:selectOneChoice value = "#{row.bindings.DepartmentId.inputValue}"
                       label = "#{row.bindings.DepartmentId.label}"
                       required = "#{bindings.EmployeesVO.hints.DepartmentId.mandatory}"
                       shortDesc = "#{bindings.EmployeesVO.hints.DepartmentId.tooltip}"
                       id = "soc1" >
     < f:selectItems value = "#{row.bindings.DepartmentId.items}"
                    id = "si1" />
   </ af:selectOneChoice >
</ af:column >

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值