Google Analytics

Tuesday, November 3, 2015

Oracle ADF LOV value change listener index selection convert to Value

ADF value change listner directly access index and hard code the valued according to the DB order will make issues when data order is changed. Presentation

String valChangeIndex = valueChangeEvent.getNewValue().toString();

0 - Male
1 - Female

Use as below.

public void aaaVCL(ValueChangeEvent valueChangeEvent) {
String indexValue = null;
if (valueChangeEvent == null || valueChangeEvent.getNewValue() == null) {
indexValue = "0";
} else {
indexValue = valueChangeEvent.getNewValue().toString();
}

String indexValueData =
(String)aaaUtils.evaluateEL("#{bindings.aaaVVO.items['" +
 indexValue + "'].label}");
}

public static Object evaluateEL (String el) {
FacesContext facesContext = FacesContext.getCurrentInstance();
ELContext elContext = facesContext.getELContext();
ExpressionFactory expressionFactory =
facesContext.getApplication().getExpressionFactory();
ValueExpression exp =
expressionFactory.createValueExpression(elContext, el,
Object.class);
return exp.getValue(elContext);
}

No comments:

Post a Comment