Vinoth Kumar C M
Vinoth Kumar C M

Reputation: 10598

Expanding Accordion Panel in PrimeFaces with a RadioButton click

Below is the snapshot of the layout I'm trying to achieve.

I have two questions/problems here:

  1. Right now,the page loads with all the accordian panels open. I want it initially to be in the closed state (like in option 1).

  2. On click of the Radio button near the tab, the tab should expand. If I click on another radio button, the new tab associated with the radio button should expand, and the other one should close.

enter image description here

How do we accomplish this ?

I don't see any toggle function or anything associated with PrimeFaces accordian. There is only widgetVar.show() function, but it's not helping me.

Upvotes: 0

Views: 4485

Answers (1)

slodj
slodj

Reputation: 33

To begin with your accordion panel tabs closed try setting activeIndex to -1 (or any value that does not correspond to an existing panel). I have not tested this with multiple tabs in an accordion panel, but it should work:

<p:accordionPanel activeIndex="-1">

Upvotes: 1

Related Questions