I am trying to load in java chords of dynamic primefaces dragable components.
My code has this look:
Primefaces
<ui:repeat value="#{bbean.list}" var="dato">
<h:panelGroup id="conpnl#{loop.index}" layout="block">
<p:outputLabel value="#{dato.desc}" />
<p:selectOneMenu id="datoCombo#{loop.index}">
<f:selectItem itemValue="" itemLabel="" />
<f:selectItems value="#{dato.values}" var="values"
itemLabel="#{value.descripcion}" itemValue="#{value.codigo}" />
</p:selectOneMenu>
<p:draggable for="conpnl#{loop.index}" containment="parent"/>
</h:panelGroup>
</ui:repeat>
<h:panelGroup>
<p:commandButton id="saveChords" actionListener="#{bbean.saveChords}"
update="@form" oncomplete="client.setDirty(false);"/>
</h:panelGroup>
Java
public void saveChords() {
UIComponent theContainer = FacesContext.getCurrentInstance().getViewRoot().findComponent("mainForm:tabs:j_idt199:0:datoCombo");
//This is dinamically how the browser has named the component (this is a test)
}
but i am not able to do it due these problems: 1)The java instruction FacesContext.getCurrentInstance().getViewRoot().findComponent("mainForm:tabs:j_idt199:0:datoCombo"); doesn't retrieve any component, but this other one yes: FacesContext.getCurrentInstance().getViewRoot().findComponent("mainForm:tabs:j_idt199:datoCombo");
How can i retrieve components defined dynamically inside ui:repeat?
2)If i could load the component in java side, how can i check its chords?