7 Answer(s)
-
0
Hi,
You can add
kt-menu__item--active
to menu item you want to expand. Metronic will automatically expand the item for you. -
0
Hi @ismcagdas
Where and how do we put the class? With CustomData on the MenuItemDefinition?
I have tried to add kt-menu__item--active on the "li" element, but it does not seem to work.
I can see that on menues expanded, there is a class on the "li" element: kt-menu__item--open And this disappear ones selecting another menu item.
-
0
You have to put it here https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Web.Mvc/Areas/AppAreaName/Views/Shared/Components/AppAreaNameMenu/_UserMenuItem.cshtml#L9.
Currently only active menu item (and its parents) have this css class.
-
0
Hi @ismcagdas
thank you :-)
but it looks like the menu is rebuilding every time you select another menu item. Is there any way to catch if a menu item is "open" and keep that state when selecting another item - eg. with no sub items?
-
0
Hi @deltavision,
This functionality is not the out of box functionality. So, you need to implement it somehow. You can store selected menu item in Browser's local storage and use it when the page is reloaded.
-
0
Hi @ismcagdas
stored the root of the selected sub-menu in session storage - and and class "kt-menu__item--open" based on that in _UserMenuItem
I close this case.
-
0
Thanks @deltavision :)