title: Auto-collapse any item in PrimeFaces PanelMenu on page loading
body: <p>I'm writing a Primefaces 5.1 portlet.</p>
  
  <p>It consists in a unique page containing a <code>panelMenu</code>, and I need that it starts with any panel collapsed everytime a user change page (on page loading).</p>
  
  <p>But, if I open a panel, then change page, it will start showing that panel still opened.</p>
  
  <p>I wasn't able to find any option to achieve this goal (e.g. collapsed=true, ignoreCookie=true or something similar).</p>
  
  <p>The only solution I found was the following Javascript code:</p>
  
  <pre><code>PrimeFaces.widgets.myPanelMenu.collapseRootSubmenu(PrimeFaces.widgets.myPanelMenu.headers);
  </code></pre>
  
  <p>The problem is that this code will collapse any opened panel (so on page loading user is able to see panel menu collapsing animation) but it seems it doesn't store this state in its cookie/localstorage... the result is that on any page loading user can see this animation.</p>
  
  <p>I'm sure it doesn't save its state, because the only way to "solve" the problem is to manually re-open and re-collapse the panels... then, on following page change, these menus start closed (and there is no animation).</p>
  
  <p>I also tried to use <code>PrimeFaces.widgets.sideMenuPanel.saveState()</code> after collapsing, but with no success.</p>
  
  <p>Do you have any idea about?</p>
  
  <p>Thank you...</p>