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

Nested Side Menu Doesn't Track Active Menu Item When 2 Levels Deep. #11143


User avatar
0
rickfrankel created

Prerequisites

Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • What is your product version?
  • 11.2.1
  • What is your product type (Angular or MVC)?
  • Angular
  • What is product framework type (.net framework or .net core)?
  • .Net Core

If issue related with ABP Framework

  • What is ABP Framework version?

If issue is about UI

  • Which theme are you using?
  • Default
  • What are the theme settings?
  • Default

In the standard template solution, I replaced the normal WebhookSubscription menu with this, in app-navigation.service.ts

                new AppMenuItem('Parent Menu', '', 'flaticon-interface-8', '', [], [
                    new AppMenuItem(
                        'WebhookSubscriptions',
                        'Pages.Administration.WebhookSubscription',
                        'flaticon2-world',
                        '/app/admin/webhook-subscriptions'
                    )
                ]),

<br> When you click on this menu item the Parent Menu collapses and you don't see which menu item is selected.  This doesn't happen if the nesting is only 1 level deep.

I'm wondering if it was broken with this fix https://support.aspnetzero.com/QA/Questions/10926/Side-bar-navigation---not-collapsing

It was working in v10


2 Answer(s)
  • User Avatar
    0
    rickfrankel created

    I have found the problem. It is this line. https://github.com/aspnetzero/aspnet-zero-core/blob/577684256e8e1a4cf58c886f820f9061d42020d5/angular/src/app/shared/layout/nav/side-bar-menu.component.ts#L151

    Changed it to this and it works fine.

        if (!this.iconMenu && this.isMenuItemIsActive(item)) {
            classes += ' show';
        }
        
        
    

    Removed the parentItem==null check as that was stopping it from adding the show class to a nested sub-menu.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks a lot @rickfrankel for sharing the problem and the solution as well :). I have created an issue https://github.com/aspnetzero/aspnet-zero-core/issues/4461 about this.