Open Closed

How can I order navigation menu items? #690


User avatar
0
alper created
Support Team Director

I want to keep the Administration menu item at the end.


1 Answer(s)
  • User Avatar
    0
    alper created
    Support Team Director

    You can use SetSubItemOrder method to set an order in YourProjectMenuContributor.cs class.

     private static async Task ConfigureMainMenuAsync(MenuConfigurationContext context)
            {
                var l = context.GetLocalizer<SAMResource>();
    
                context.Menu.AddItem(new ApplicationMenuItem(
                    SAMMenus.Home,
                    l["Menu:Home"],
                    "/",
                    icon: "fas fa-home",
                    order: 1
                ));
    
                //Administration
                var administration = context.Menu.GetAdministration();
                administration.Order = 2;
    
                //Administration->Saas
                administration.SetSubItemOrder(SaasHostMenus.GroupName, 1);
    
                //Administration->Identity
                administration.SetSubItemOrder(IdentityProMenus.GroupName, 2);
    
                //Administration->Language Management
                administration.SetSubItemOrder(LanguageManagementMenus.GroupName, 3);
    
                //Administration->Text Template Management
                administration.SetSubItemOrder(TextTemplateManagementMenus.GroupName, 4);
    
                //Administration->Audit Logs
                administration.SetSubItemOrder(AbpAuditLoggingMenus.GroupName, 5);
    
                //Administration->Settings
                administration.SetSubItemOrder(SettingManagementMenus.GroupName, 6);
                
       }
    
Made with ❤️ on ABP v9.1.0-preview. Updated on December 10, 2024, 06:38