Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

primefaces p:selectBooleanButton listener not triggered in nested ui:repeat

The listener is triggered for the p:selectBooleanButton in parent ui:repeat, but the listener for p:selectBooleanButton is not triggered for the inner/child ui:repeat.

We cannot use nested forms. Any suggestions.

<h:form prependId="false">
 <ui:repeat value="#{xBean.sectionsList}" var="sectionItem">
  <p:fieldset>
   <p:selectBooleanButton onLabel="ON" offLabel="OFF" value="#{sectionItem.checked}">
    <p:ajax listener="#{xBean.selectSection}"/>
   </p:selectBooleanButton> :
   <ui:repeat value="#{sectionItem.sectionOptionsList}" var="sectionOptionItem">            
    <p:selectBooleanButton onLabel="ON" offLabel="OFF" value="#{sectionOptionItem.checked}">
     <p:ajax listener="#{xBean.selectSectionOption}"/>
    </p:selectBooleanButton>
    </ui:repeat>
   </p:fieldset>
 </ui:repeat>
</h:form>
like image 770
Sid Muthiah Avatar asked Nov 03 '22 07:11

Sid Muthiah


1 Answers

The <ui:repeat> is a view render time tag. Thus, it's physically present in the JSF component tree and generates its HTML output as many times as it needs to iterate over the value.

In other words, they(p:selectBooleanButton) needs to be prepared during the view build time instead of the view render time.

The JSTL <c:forEach> is a view build time tag. It will generate physically multiple components into the JSF component tree.

like image 95
Kishor Prakash Avatar answered Nov 17 '22 23:11

Kishor Prakash