Search code examples
jsf-2richfaces

collapse a collapsiblePanel by Javascript


I would like to know how to collapse a collapsiblePanel (richfaces 4) by Javascript ?

I was using SimpleTogglePanel (richfaces 3) with SimpleTogglePanelManager.toggleOnClien to do this. Is there any alternative similar manager for collapsiblePanel in richfaces 4.


Solution

  • Here is a way to collapse the panel:

    // For collapsiblePanel 'false' is collapsed item.
    RichFaces.$(panelClientId).switchToItem('false');
    

    or with EL:

    #{rich:component('panelId')}.switchToItem('false');