Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding the first tab of accordion panel in JSF Primefaces

By default the first tab of the primefaces accordion panel is shown open on page load. Is there a way that it can be closed on page load.

Thanks

like image 472
Karanveer Singh Sodhi Avatar asked Apr 17 '12 10:04

Karanveer Singh Sodhi


3 Answers

You can just do

<p:accordionPanel activeIndex="-1">
like image 128
Chriskot Avatar answered Nov 14 '22 11:11

Chriskot


One approach is to define a widgetVar:

<p:accordionPanel widgetVar="accordion">
    ...
</p:accordionPanel>

And then:

<body onload="PF('accordion').unselect(0)">

or for older PF versions:

<body onload="accordion.unselect(0)">
like image 40
Sebi Avatar answered Nov 14 '22 11:11

Sebi


It works if you set activeIndex to blank (Primefaces 3.4.1).

<p:accordionPanel activeIndex="">
like image 7
Josef Avatar answered Nov 14 '22 12:11

Josef