Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Menu - keep sub-menu expanded, when selecting another menu item #8774


User avatar
0
deltavision created

Hi,

using: Core, MVC, jQuery project - v7.2.2

Is it possible to keep sub-menu expanded (dropped-down) when selecting another menu-item outside the sub-menu?


7 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can add kt-menu__item--active to menu item you want to expand. Metronic will automatically expand the item for you.

  • User Avatar
    0
    deltavision created

    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.

  • User Avatar
    0
    ismcagdas created
    Support Team
  • User Avatar
    0
    deltavision created

    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?

  • User Avatar
    0
    ismcagdas created
    Support Team

    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.

  • User Avatar
    0
    deltavision created

    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.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks @deltavision :)