How to change activeindex in tabMenu (morpheus component)?

Post Reply
hecnabae
Posts: 2
Joined: 20 May 2015, 09:57
Location: Valencia (Spain)
Contact:

23 Feb 2017, 11:39

When load a page and open menu, it shows the last menuItem, how can I change this behavior? Thanks in advance.
Senior software engineer at http://mes-view.com

User avatar
aragorn
Posts: 2659
Joined: 29 Jun 2013, 12:38

07 Mar 2017, 11:50

When you click an item, we add its id to cookie whose name is "morpheus_expandeditems". Maybe, you can use clearMenuState and clearActiveItems methods or add id of an item to cookie with addMenuitem(id). Exp;

Code: Select all

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

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


SirWagner07
Posts: 2
Joined: 02 Mar 2014, 06:18

15 Apr 2017, 02:47

aragorn wrote:
07 Mar 2017, 11:50
When you click an item, we add its id to cookie whose name is "morpheus_expandeditems". Maybe, you can use clearMenuState and clearActiveItems methods or add id of an item to cookie with addMenuitem(id). Exp;

Code: Select all

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

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

I tried this solution, but nothing happen...have anyway to make it in Managed Beans?

User avatar
aragorn
Posts: 2659
Joined: 29 Jun 2013, 12:38

17 Apr 2017, 08:25

You can use RequestContext.execute('your_JS_method') in a method of bean.

Code: Select all

//bean
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