How to change activeindex in tabMenu (morpheus component)?

Forum rules
Please note that response time for technical support is within 3-5 business days.
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

mert.sincan
Posts: 5281
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?

mert.sincan
Posts: 5281
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

Return to “Morpheus - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 6 guests