clearMenuState

spadovan
Posts: 121
Joined: 05 Jun 2013, 12:04

22 Feb 2017, 16:55

Hi Aragorn...it's still me.

I've putted this code in the page wjere i like to clear menu:

Code: Select all

		<script>
			$( document ).ready(function() {
				PF('sidebar-menu').clearMenuState();
				PF('sidebar-menu').clearActiveItems();
			});
		</script>
When i enter in this page the menu is cleared but the cookie is valorized whith the current menu item selected, so if then i click on another menu item, it will highlight both of them...

Thanks
Primefaces 6.0.14, Mojorra 2.2.8, Wildfly 10.1.0, JDK 8

spadovan
Posts: 121
Joined: 05 Jun 2013, 12:04

22 Feb 2017, 16:57

BTW i'm currently using ultima layout....not omega
Primefaces 6.0.14, Mojorra 2.2.8, Wildfly 10.1.0, JDK 8

spadovan
Posts: 121
Joined: 05 Jun 2013, 12:04

02 Mar 2017, 10:46

I resolved modifying the code of the clearActiveItems function, adding

this.expandedMenuitems = [];

Code: Select all

	clearActiveItems: function () {
		var activeItems = this.jq.find('li.active-menuitem');
		subContainers = activeItems.children('ul');

		activeItems.removeClass('active-menuitem');
		if (subContainers && subContainers.length) {
			subContainers.hide();
		}
[b]		this.expandedMenuitems = [];[/b]
	},
Primefaces 6.0.14, Mojorra 2.2.8, Wildfly 10.1.0, JDK 8

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

07 Mar 2017, 15:43

Good solution, thanks alot for the update!

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest