Friday 23 June 2017

How to create SelectManyChoice in ADF table

Creating SelectOneChoice or SelectManyChoice is way similar at model layer.
Only changes need to done is manually updating the component to SelectManyChoice and model value type supported.

Below example is created using Employee table HR schema.

1. Let's create a transient attribute in View Object and Create View Accessor(LOV)




Default list type - Choice List




2. In ViewController project

Drag and drop adf table from dataControls in default mode and run the application.

You will find af:SelectOneChoice generated by default.





Now goto your jsff file and change SelectOneChoice to SelectManyChoice and value property.

Sample code snippet below:

<af:column sortProperty="#{bindings.EmployeesView.hints.DepartmentName.name}"
               sortable="false"
               headerText="#{bindings.EmployeesView.hints.DepartmentName.label}"
               id="c5">
      <af:selectManyChoice value="#{row.bindings.DepartmentName.selectionIndices}"
                          label="#{row.bindings.DepartmentName.label}"
                          required="#{bindings.EmployeesView.hints.DepartmentName.mandatory}"
                          shortDesc="#{bindings.EmployeesView.hints.DepartmentName.tooltip}"
                          id="soc1">
        <f:selectItems value="#{row.bindings.DepartmentName.items}" id="si1"/>
      </af:selectManyChoice>
    </af:column>

UI after change:




*Comments and feedback are most welcomed, Thanks.