Page 1 of 1

How to change activeindex in tabMenu (morpheus component)?

Posted: 23 Feb 2017, 11:39
by hecnabae
When load a page and open menu, it shows the last menuItem, how can I change this behavior? Thanks in advance.

Re: How to change activeindex in tabMenu (morpheus component)?

Posted: 07 Mar 2017, 11:50
by mert.sincan
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" .../>


Re: How to change activeindex in tabMenu (morpheus component)?

Posted: 15 Apr 2017, 02:47
by SirWagner07
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?

Re: How to change activeindex in tabMenu (morpheus component)?

Posted: 17 Apr 2017, 08:25
by mert.sincan
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" .../>