Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If your content is in the same order example :</p> <p><code>listeSaisieCmpltsModel.listeComplements</code> contains</p> <ol> <li>Column A</li> <li>Column B</li> <li>Column C etc</li> </ol> <p><code>row.listeComplements</code> contains</p> <ol> <li>Column A data</li> <li>Column B data</li> <li>Column C data etc</li> </ol> <p>You can do it using the <code>c:forEach</code> <code>varStatus</code> :</p> <p><strong>View :</strong></p> <pre><code>&lt;rich:dataTable id="idList" value="#{listeSaisieCmpltsModel.listTitre}" var="row"&gt; &lt;rich:column id="name"&gt; &lt;f:facet name="header"&gt;Ref Titre&lt;/f:facet&gt; &lt;h:outputText value="#{row.refTitre}" /&gt; &lt;/rich:column&gt; &lt;c:forEach items="#{listeSaisieCmpltsModel.listeComplements}" var="column" varStatus="status"&gt; &lt;rich:column&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="#{column.libelleCoplement}" /&gt; &lt;/f:facet&gt; &lt;h:inputText value="#{row.listeComplements[status.index].valeur}" /&gt; &lt;/rich:column&gt; &lt;/c:forEach&gt; &lt;/rich:dataTable&gt; </code></pre> <p>I'm not sure about your exact list getter from your <code>TitresRechercherComplementsSortieDTO</code> inside <code>#{row.listeComplements[status.index].valeur}</code> indeed.</p> <p><strong>Another</strong> option is to modify the DTO to add a method that will return the right data for the right column like this :</p> <p><strong>View :</strong></p> <pre><code>&lt;rich:dataTable id="idList" value="#{listeSaisieCmpltsModel.listTitre}" var="row"&gt; &lt;rich:column id="name"&gt; &lt;f:facet name="header"&gt;Ref Titre&lt;/f:facet&gt; &lt;h:outputText value="#{row.refTitre}" /&gt; &lt;/rich:column&gt; &lt;c:forEach items="#{listeSaisieCmpltsModel.listeComplements}" var="column" varStatus="status"&gt; &lt;rich:column&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="#{column.libelleCoplement}" /&gt; &lt;/f:facet&gt; &lt;h:inputText value="#{row.getColumnData(column).valeur}" /&gt; &lt;/rich:column&gt; &lt;/c:forEach&gt; &lt;/rich:dataTable&gt; </code></pre> <p><strong>DTO :</strong></p> <pre><code>public class TitresRechercherComplementsSortieDTO { protected List&lt;ComplementsTitresSortieDTO&gt; listeComplements; public ComplementsTitresSortieDTO getColumnData(ComplementsTitresSortieDTO column) { ComplementsTitresSortieDTO data; for(ComplementsTitresSortieDTO dto : getListeComplements()) { if(dto.getCodeComplement() == column.getCodeComplement()) { data = dto; break; } } return data; } } </code></pre> <p><strong>EDIT :</strong></p> <p>Since the DTO can't be modified, the function must be moved to the bean like this :</p> <pre><code>public class ListeSaisieCmpltsModel { public ComplementsTitresSortieDTO getColumnData(TitresRechercherComplementsSortieDTO dtoInput, ComplementsTitresSortieDTO column) { ComplementsTitresSortieDTO data = null; for(ComplementsTitresSortieDTO dto : dtoInput.getListeComplements()) { if(dto.getCodeComplement() == column.getCodeComplement()) { data = dto; break; } } return data; } } </code></pre> <p>And in the view :</p> <pre><code>&lt;h:inputText value="#{listeSaisieCmpltsModel.getColumnData(row,column).valeur}" /&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload