Hi Aragorn, i'd like to reset menu (of sidebar) when i load a certain page.
Reading the forum i found that you said to call
PF('menuWidget').clearMenuState()
But it seem it doesn't work and clearMenuState is not been called.
Could ypu please help me once more ?
Thanks
Simone
clearMenuState
Forum rules
Please note that response time for technical support is within 3-5 business days.
Please note that response time for technical support is within 3-5 business days.
I've named my po:menu tag with a widgetvar and calling widgetvar.clearMenuState() works, but it's too late because the menu is already built and only refreshing the page i can see thet the menu is cleared.
How can i force the menu to be clear in current page ?
Thanks
How can i force the menu to be clear in current page ?
Thanks
Primefaces 12.0.2, Wildfly 24.0.1, JDK 11
clearMenuState clears the cookie of the state of expanded items but does not clear the "active-item" style from the menu.
I'd like to have a function like menu.clearActiveState() which for a menu walks its children and performs a item.removeClass('active-menuitem');
I'd like to have a function like menu.clearActiveState() which for a menu walks its children and performs a item.removeClass('active-menuitem');
Primefaces 12.0.2, Wildfly 24.0.1, JDK 11
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Sorry for your late reply, please add the following code into layout.js;
I'll add this method into next version.
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();
}
}
...
Github Profile: https://github.com/mertsincan
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
No problem, what PF version are you using?
Github Profile: https://github.com/mertsincan
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Thanks for the update, please try;
You can use PF('menuWidgetVar').clearActiveItems(); after removing menu state with ...clearMenuState();
Code: Select all
/**
* PrimeFaces Omega Layout
*/
PrimeFaces.widget.Omega = PrimeFaces.widget.BaseWidget.extend({
/* Other methods */
...
clearActiveItems: function() {
var activeItems = this.jq.find('li.active-menuitem'),
subContainers = activeItems.children('ul');
activeItems.removeClass('active-menuitem');
if(subContainers && subContainers.length) {
subContainers.hide();
}
}
});
Github Profile: https://github.com/mertsincan
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Glad to hear, thanks for the update! Also, I added this method into next release.
Github Profile: https://github.com/mertsincan
-
- Information
-
Who is online
Users browsing this forum: No registered users and 8 guests