1

I'm currently working on a CRUD application and I have defined a LOV like this:

enter image description here

My question is how can I get all these return values in for example a ValueChangeListener defined like this:

public void onValueChanged(ValueChangeEvent ev){
    BindingContext bctx = BindingContext.getCurrent();
    oracle.binding.BindingContainer bindings = bctx.getCurrentBindingsEntry();
    DCIteratorBinding iterBind = (DCIteratorBinding)bindings.get("MpStavkeulazaView5Iterator");
    System.out.println("Vrijednost je" + ev.getNewValue());
}

This code only gives me the value of the list attribute, but I want the other values too.

Any other info please tell me.

EldarGranulo
  • 1,575
  • 1
  • 14
  • 37

2 Answers2

1

First of all - using backing bean's value change listener is not ideal for such use case: Try instead the setter on your Row Impl for the same purpose.

Remember: if you can't test your use case from BC tester, your ADF design is flawed.

Second of all: your LOV can return multiple values: http://adfbugs.blogspot.co.uk/2009/11/returning-multiple-values-from-lov-in.html

Florin Marcus
  • 1,657
  • 1
  • 12
  • 11
1

You can bind row attributes and then get values of this bindings or just get this attributes from iterator. If you going to handle it in valueChangeListener you'll have to process updates, before getting this values:

public void onValueChanged(ValueChangeEvent ev){
  BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
  DCIteratorBinding iterBind = (DCIteratorBinding)bindings.get("MpStavkeulazaView5Iterator");
  System.out.println("Vrijednost je" + ev.getNewValue());
  ev.processUpdates(FacesContext.getCurrentInstance());
  Row row = iterBind.getCurrentRow();
  System.out.println("Proizvod: " + row.getAttribute("Proizvod"));
  System.out.println("Jmjere: " + row.getAttribute("Jmjere"));
}

However its may be better to use Transient attribute in your ViewObject and do calculations there?

Nagh
  • 1,757
  • 1
  • 14
  • 19