How force menu activeIndex back to 0?

Forum rules
Please note that response time for technical support is within 3-5 business days.
Post Reply
SirWagner07
Posts: 2
Joined: 02 Mar 2014, 06:18

15 Apr 2017, 02:03

Im doing a application with logout and login options.

When someone open randon menu tab and after this do logout, i wanna reset the current tab actived to the first tab...because when another ppl log in the same browser, the menu came opened in the last tab that previous user gone.

How can i do it?

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

17 Apr 2017, 08:29

You can clear menu state after login or logout. Please try ;

Code: Select all

//bean
public void login/logout_Method() {
   RequestContext.getCurrentInstance().execute("clearState");
}

//xhtml
<script type="text/javascript">
        function clearState() {
            var $this = PF('me');
            if($this) {
                $this.clearMenuState();
                $this.clearActiveItems();
            }
        };
</script>

<pm:menu widgetVar="me" .../>

Post Reply

Return to “Morpheus - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests