I'm using PrimeFaces' p:fieldset
component and I want to control, from my bean, either or not it's collapsed. I expected the collpased
property to do this job, but this is not working.
On the other hand, a "binding" seems to correctly mirror the component's state:
My Bean
@Named
@RequestScoped
public class TestBean {
//with get/set
private boolean collapsed;
//with get/set
private Fieldset fieldset;
}
My page:
<h:form>
<p:fieldset
id="togglebleFieldset"
legend="Toggleable Fieldset"
toggleable="true"
binding="#{testBean.fieldset}"
collapsed="#{testBean.collapsed}">
fieldset content
<p:ajax event="toggle" update="@form"/>
</p:fieldset>
<h:outputText value="Value is never updated: #{testBean.collapsed}" />
<br/><h:outputText value="Binding correctly reflects the state: #{testBean.fieldset.collapsed}" />
</h:form>
For reasons beyond the scope of this question, using the binding solution will be a little bit more complicated to me.
Why isn't #{testBean.collapsed}
being update with the component's collapsed value?
(Using versions 6.0 and 6.2 of PrimeFaces)