Open Closed

Define a new MenuDefinition in addition to MainMenu #190


0
behiunforgiven created

How Can I define a new MenuDefinition in addition to MainMenu? I want to create a separate menu in sidebar

In my NavigationProvider i create it by this code

context.Manager.Menus.Add("SideBarMenu",
                new MenuDefinition(
                    "SideBarMenu",
                    new LocalizableString("SideBaeMenu", EPEDCConsts.LocalizationSourceName))
                    );

but i can't use it and add MenuItems!


3 Answer(s)
  • 0
    hikalkan created
    Support Team

    In C#, inject IUserNavigationManagerand use GetMenuAsync("SideBarMenu", ...). Second parameter can be current user id or null (see <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/src/Abp/Application/Navigation/IUserNavigationManager.cs">https://github.com/aspnetboilerplate/as ... Manager.cs</a>).

    In javascript, you can get it using abp.nav.menus.SideBarMenu

  • 0
    behiunforgiven created

    Thank you, but how can I add items to my "SideBarMenu" ?

  • 0
    hikalkan created
    Support Team

    You should simple add items to the MenuDefinition object before passing it to context.Manager.Menus.Add method. Nothing special here.

    Thanks.