Home » Oracle ADF » Recorrer Iterator y rellenar SelectOneChoice ADF

0

public void populate_provinciasLOV(RichSelectOneChoice IUSelectOneChoice, UISelectItems UISelItem, BigDecimal Pais)

{ BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();

//Ejecutamos la consulta pasándole un parámetro bindings.getOperationBinding(“ExecuteWithParams”).getParamsMap().put( “x_pais_id”,Pais);

bindings.getOperationBinding(“ExecuteWithParams”).execute();

 

//Localizamos el Iterator que queremos recorrer

DCBindingContainer bindings1 = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();

DCIteratorBinding ProvIter = bindings1.findIteratorBinding(“ProvinciasView1Iterator”);

//Empezamos a recorrer el iterator y creamos una lista con los valores

Row[] provs = ProvIter.getAllRowsInRange();

 

SelectItem si;

List<SelectItem> datos = new ArrayList<SelectItem>();

 

for (Row prov:provs) {

System.out.println(“Pais” + prov.getAttribute(“Nombre”).toString());

 

si = new SelectItem();

 

si.setLabel(prov.getAttribute(“Nombre”).toString());

 

si.setValue(prov.getAttribute(“ProvinciaId”).toString());

//Añadimos el elemento a nuestra lista

 

datos.add(si);

 

}

 

//Asociamos la lista de elementos al elemento f:selectItems

 

//UISelItem.setValue(datos);

 

//Hacemos un partialTrigger al objeto SelectOneChoice

 

RequestContext.getCurrentInstance().addPartialTarget(IUSelectOneChoice);

Share

Leave a Reply

You must be Logged in to post comment.

office automation book