Hello All ,
This tutorial is based on use of selectManyListbox & selectManyCheckbox component in ADF to enable multiple selection.
Both component are same in functionality only somewhat different in look-feel.
Follow steps to use these component -
- Create a fusion web application and create business components for Departments table of HR Schema
- Now create a page and drop Departments Vo from data control on page as multiple selection (checkbox or listbox)
- Now binding for this component is created in page-bindings, add a button on page to get total selected values
Select All-
And Check-box component look like this-
Complete code written on '
Get Selected Values' button-
/**Method to get BindingContainer of page
* @return
*/
public BindingContainer getBindings() {
return BindingContext.getCurrent().getCurrentBindingsEntry();
}
/**Method to get Selected Values
* @param actionEvent
*/
public void getSelectedValue(ActionEvent actionEvent) {
JUCtrlListBinding listBindings = (JUCtrlListBinding)getBindings().get("DepartmentsView1");
Object str[] = listBindings.getSelectedValues();
StringBuilder saveMsg =
new StringBuilder("<html><body><b><p style='color:red'>Selected Departments are-</p></b>");
saveMsg.append("<ul>");
for (int i = 0; i < str.length; i++) {
System.out.println(str[i]);
saveMsg.append("<li> <b>" + str[i].toString() + "</b></li>");
}
saveMsg.append("</ul><br>");
saveMsg.append("</body></html>");
FacesMessage msg = new FacesMessage(saveMsg.toString());
FacesContext.getCurrentInstance().addMessage(null, msg);
}
Cheers-
Download Sample