filtering the SelectOncChoice in backing bean
In many times, when BC4J layer is not there in picture, we may need to filter the values coming in the selectOneChoice in the bean. for this
First we need to fill the first we need fill the values in the selecteItems from the bean
<f:selectItems value="#{BackingBean.subSelectItems}" id="si1"/>
// this method will fill values in the list
public List<SelectItem> getSubSelectItem() {
// Collection to display
List<SelectItem> selectItems = new ArrayList<SelectItem>();
// Iterator on which list is based.
DCIteratorBinding listIterator =(DCIteratorBinding)ADFUtils.findIterator("ListIteratorInBindings");
Integer rowOrderParentId;
// Iteratrate through the rows in the iterator
for (Row r : listIterator.getAllRowsInRange()) {
Object rowOrderParentIdObj = r.getAttribute("filterValue");
rowOrderParentId = (Integer ) rowOrderParentIdObj ;
// filter a selected values in the bean.
if (selectedParentWBS== null || selectedParentWBS.compareTo(rowOrderParentId) ==0){
// Push the value to display in bean.
selectItems.add(new SelectItem(r.getAttribute("name")));
}
}
return selectItems;
}
First we need to fill the first we need fill the values in the selecteItems from the bean
<f:selectItems value="#{BackingBean.subSelectItems}" id="si1"/>
// this method will fill values in the list
public List<SelectItem> getSubSelectItem() {
// Collection to display
List<SelectItem> selectItems = new ArrayList<SelectItem>();
// Iterator on which list is based.
DCIteratorBinding listIterator =(DCIteratorBinding)ADFUtils.findIterator("ListIteratorInBindings");
Integer rowOrderParentId;
// Iteratrate through the rows in the iterator
for (Row r : listIterator.getAllRowsInRange()) {
Object rowOrderParentIdObj = r.getAttribute("filterValue");
rowOrderParentId = (Integer ) rowOrderParentIdObj ;
// filter a selected values in the bean.
if (selectedParentWBS== null || selectedParentWBS.compareTo(rowOrderParentId) ==0){
// Push the value to display in bean.
selectItems.add(new SelectItem(r.getAttribute("name")));
}
}
return selectItems;
}
Comments