Expanding Accordion Panel in PrimeFaces with a RadioButton click

一笑奈何 提交于 2019-12-13 06:07:20

问题


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.

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.


回答1:


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">



来源:https://stackoverflow.com/questions/16912889/expanding-accordion-panel-in-primefaces-with-a-radiobutton-click

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!