Hi Julien,

When the submitted data is processed setSelectedClientTemp will be called once for each row in the table where the selected value has changed.

In this setter method, you can use the clientsAndQuantities binding to access the UIData component, and from that can call things like: * getRowData -- returns the current element from the listOfMiddleFormHelpers list * getRowIndex -- returns the current index into the listOfMiddleFormHelpers list (ie the current table row). You could then use this as in index into a separate list of selectedClient values.

However a more elegant solution (IMO) would be to write a simple wrapper class that holds both the selectedClientTemp value and a reference to a MiddleFormHelper object. The dataTable value can then refer to a list of these objects rather than a list of MiddleFormHelper objects and all the components in the columns can then be written using just the "line" variable and no binding is needed.

Hope this is the info you needed..

Regards,

Simon

Julien Martin wrote:
Hello all,

I have a dataTable and have developped a method that dynamically adds rows to the dataTable. Each row is made up of two form controls. The problem I have now is that I don't know how to retrieve the values from the mutiple rows. Ideally I would need the values to be stored into a list.

Can anyone help?

Thanks in advance,

Julien.

Here is my code:
[code]
<h:dataTable var="line" binding="#{TradeClientsAndQuantitiesBean.clientsAndQuantities}" value="#{ TradeClientsAndQuantitiesBean.listOfMiddleFormHelpers}">
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Sélectionnez un client"/>
                </f:facet>
<h:selectOneMenu value="#{TradeClientsAndQuantitiesHelperBean.selectedClientTemp}"> <f:selectItems value="#{TradeClientsAndQuantitiesHelperBean.concatenatedLabelMap }"/>
                </h:selectOneMenu>
</h:column> <h:column>
                <f:facet name="header">
                    <h:outputText value="Renseignez une quantité"/>
                </f:facet>
                <h:inputText value=""/>
</h:column> </h:dataTable>
[/code]

Reply via email to