Programmatically set active-menuitem
Posted: 27 May 2020, 11:27
Hi there,
I've been searching quite a while now and cannot find a solution:
I've implemented a dynamic menu to create the menu of my page. Depending on several parameters, the landing page can be different. Example:
Suppose there's a communications environment in which the menu items are
Mirage uses cookies to restore the menu state based on what the user has chosen previously. So suppose last time (s)he has chosen "Pictures", the result now is that the menu item "Pictures" is marked as active-menuitem but the displayed page is "E-mail".
I was already able to clear the cookies so that no menu item is active, but now I'm trying to activate the correct menuitem. I got most successful by calling
but since the page is rebuild using ajax, this only works once (.custom-active-menuitem is a class that I set in Java code)
So now I'm puzzled. Can someone please get me in the correct direction? How can I let Mirage show the menu item I choose as active one?
I've been searching quite a while now and cannot find a solution:
I've implemented a dynamic menu to create the menu of my page. Depending on several parameters, the landing page can be different. Example:
Suppose there's a communications environment in which the menu items are
- Documents
- Pictures
Mirage uses cookies to restore the menu state based on what the user has chosen previously. So suppose last time (s)he has chosen "Pictures", the result now is that the menu item "Pictures" is marked as active-menuitem but the displayed page is "E-mail".
I was already able to clear the cookies so that no menu item is active, but now I'm trying to activate the correct menuitem. I got most successful by calling
Code: Select all
PF('sidebarMenu').activate($('.custom-active-menuitem').closest('li'));
PF('sidebarMenu').activate($('.custom-active-menuitem').closest('ul').closest('li'));
So now I'm puzzled. Can someone please get me in the correct direction? How can I let Mirage show the menu item I choose as active one?