I am having trouble with populating a SelectOneMenu inside a DataTable. I access a database to get an ArrayList of vl (datatable var) beans. That works perfectly. The problem comes when I try put a SelectOneMenu in a column because the values of the SelectOneMenu are also got from the database and depend on the values got from the previous database access. Sorry, if the explanation is not clear enough.
<h:dataTable border="0" id="constituyentes" value="#{db_inserta.constituyentes}" var="vl">
<h:column>
<f:facet name="header">
<h:outputText value="Constituyente"/>
</f:facet>
<h:outputText value="#{vl.descripcion}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Resultado"/>
</f:facet>
<h:selectOneMenu id="elige" value="#{vl.resultado}">
<f:selectItems value="?????????????" />
</h:selectOneMenu>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Unidades"/>
</f:facet>
<h:outputText value="#{vl.unidades}"/>
</h:column>
</h:dataTable>
The problem comes with the value of SelectItems. It has to create dynamicly the list of values accessing to a database that depends on the values got from a previous access, the one that gives you the row.
Thanks