Note that there are some explanatory texts on larger screens.

plurals
  1. POJSF 2 ui:repeat vs h:datatable behavior
    text
    copied!<p>I had a bad time trying to solve <a href="https://stackoverflow.com/questions/20576218/pselectbooleanbutton-doesnt-render-preselected-value">p:selectBooleanButton doesn't render preselected value</a>, a lot of hours just to fix it changing ui:repeat to h:datatable.</p> <p>Here is both pieces of code.</p> <pre><code> &lt;ui:repeat value="#{presupuestoBean.getItemsPresupuestBySeccion('Parte Delantera')}" var="itemPresupuesto"&gt; &lt;tr&gt; &lt;td&gt;&lt;h:outputText value="#{itemPresupuesto.descripcion}"/&gt;&lt;/td&gt; &lt;td&gt; &lt;p:selectBooleanButton value="#{presupuestoBean.itemsPresupuestoAsignadoCambiar[itemPresupuesto.id]}" onLabel="Yes" offLabel="No" onIcon="ui-icon-check" offIcon="ui-icon-close"/&gt; &lt;h:outputText value="#{presupuestoBean.itemsPresupuestoAsignadoCambiar[itemPresupuesto.id]}" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/ui:repeat&gt; </code></pre> <p><img src="https://i.stack.imgur.com/Xl66Y.jpg" alt="UI repeat output"></p> <p>(Notice that the button is showing 'FALSE (or NO)' value although the property value is 'TRUE' as displayed by outputText)</p> <p>On the other hand, the exactly same code with h:datatable.</p> <pre><code> &lt;h:dataTable value="#{presupuestoBean.getItemsPresupuestBySeccion('Parte Delantera')}" var="itemPresupuesto2"&gt; &lt;h:column&gt; &lt;h:outputText value="#{itemPresupuesto2.descripcion}"/&gt; &lt;/h:column&gt; &lt;h:column&gt; &lt;p:selectBooleanButton value="#{presupuestoBean.itemsPresupuestoAsignadoCambiar[itemPresupuesto2.id]}" onLabel="Si" offLabel="No" onIcon="ui-icon-check" offIcon="ui-icon-close"/&gt; &lt;h:outputText value="#{presupuestoBean.itemsPresupuestoAsignadoCambiar[itemPresupuesto2.id]}" /&gt; &lt;/h:column&gt; &lt;/h:dataTable&gt; </code></pre> <p><img src="https://i.stack.imgur.com/OFYf9.jpg" alt="Datatable Ouput"></p> <p>Anyone know why is this happening ??. As far as I know, this two tags could be exchangeable. (at least according the example that I saw e.g <a href="http://www.mkyong.com/jsf2/jsf-2-repeat-tag-example/" rel="nofollow noreferrer">JSF 2 Repeat Tag Example</a>)</p> <p>I'm using com.sun.faces jsf-api and jsf-impl 2.2.4 Also Primefaces 4.0</p>
 

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