How force menu activeIndex back to 0?

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?

User avatar
aragorn
Posts: 2371
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
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest