Thursday, December 2, 2010

ADF SelectOneChoice without base datasource

PageDefinition:
Create Iterator in your executables section.
and create a list binding in your bindings section to this iterator.
Sample page definition code:




















Page:
Drag and drop the selectonechoice component and bind it to above created binding.

Note that selectonechoice will return index, use iterator bind to get the value at selected index below is backing bean code
public void choiceListListener(ValueChangeEvent valueChangeEvent) {
DCIteratorBinding iter=((DCBindingContainer)getBindings()).findIteratorBinding("Departments1View1Iterator");
Row r=iter.getRowAtRangeIndex((Integer)valueChangeEvent.getNewValue());
System.out.println("Attr names"+r.getAttribute("DepartmentId"));
System.out.println("Attr names"+r.getAttribute("DepartmentName"));
System.out.println("atr1");
//set value of your variable equal to "value"
}