Page 1 of 1

Question: How to assign active-menuitem

Posted: 29 Dec 2016, 01:38
by Melloware
In pa:tabmenu I cannot figure out how menu items get assigned class="active-menuitem". There does not seem to be any rhyme or reason on which menu items are highlighted by default. I see once I click a menu option the active-menuitem class gets assigned but nothing about defaulting or allowing us to assign what menu item is active.

Is there some way to control this?

Clear all active menu items?

Re: Question: How to assign active-menuitem

Posted: 06 Jan 2017, 14:18
by mert.sincan
I think you can use atlantis_expandeditems cookie.
To add an item; PF('menuWidget').addMenuitem(id)
To clear all item; PF('menuWidget').clearMenuState();

Re: Question: How to assign active-menuitem

Posted: 06 Jan 2017, 14:54
by Melloware
So clearMenuState clears the cookie of the state of expanded items etc but does not clear the "active-item" style from the menu.

What I want is a widget function like menu.clearActiveState() which for a menu walks its children and performs a item.removeClass('active-menuitem');

Re: Question: How to assign active-menuitem

Posted: 09 Jan 2017, 10:30
by mert.sincan
Added clearActiveItems method to next release for pa:menu.

Re: Question: How to assign active-menuitem

Posted: 09 Jan 2017, 14:17
by Melloware
Thank you!

Re: Question: How to assign active-menuitem

Posted: 09 Jan 2017, 14:21
by mert.sincan
You're welcome!

Re: Question: How to assign active-menuitem

Posted: 01 Apr 2020, 20:26
by hungar
Why is there no documentation for the Client Side API of the Menu object in the Primefaces Documentation? It looks like there are at least two methods:

e.g.:
PF('mainmenu').clearMenuState()
PF('mainmenu').clearActiveItems()

Re: Question: How to assign active-menuitem

Posted: 02 Apr 2020, 13:58
by Melloware
Do you mean in the main PrimeFaces documentation or the Atlantis documentation?

These look like Atlantis Specific widget methods for the layout so I assume you mean there?