Reputation: 223
I'm using primefaces 3.5 and I have a p:fieldset and a p:commandbutton, I'm able to toggle the fieldset using the button using it's client side api method
oncomplete="detailsFieldset.toggle()"
but I'd like to only Expand the fieldset if it's collapsed not the opposite.
Upvotes: 2
Views: 4188
Reputation: 1
Modified the above solution by Daniel
oncomplete="if($(detailsFieldset.toggleStateHolder).attr('value') === 'true'){detailsFieldset.toggle();}"
to
oncomplete="if($(detailsFieldset.stateHolder).attr('value') === 'true'){detailsFieldset.toggle();}"
for it to work for me.
Upvotes: 0
Reputation: 37051
You can use this:
oncomplete="if($(detailsFieldset.toggleStateHolder).attr('value') === 'true'){det
ailsFieldset.toggle();}"
toggleStateHolder
holds the state of the collapsed mode... so when its value is true
it means that the p:fieldset
(or any other pf collapsible element) is collapsed.
Upvotes: 1