Open Closed

PageHeaderOptions not working #5890


User avatar
0
ageiter created
  • ABP Framework version: v7.3.3
  • LeptonX version: v2.3.3
  • UI Type: Blazor Server

I have created a new Blazor server project with the latest version 7.3.3. I use the LeptonX 2.3.3 theme with the TopMenu layout. I saw in the documentation that I can disable the breadcrumbs by doing the following:

        Configure<PageHeaderOptions>(options =>
        {
            options.RenderBreadcrumbs = false;
        });

When I look with the debugger, this value is already initialized with "false". And still the breadcrumbs are not hidden. Also the other options (PageTitle & Toolbar) do not work.

By the way, another bug with LeptonX options: I already wrote this in the thread, the options for MobileMenuSelector don't work either.... Is there any news about this? Could the bug be reproduced?

        Configure<LeptonXThemeBlazorOptions>(options =>
        {
            options.Layout = LeptonXBlazorLayouts.TopMenu;
            options.MobileMenuSelector = items => items.Where(x => x.MenuItem.Name == "Home");
        });

Since I think this is a bug, I would appreciate it if you would credit me back the points.

Thanks, Adrian


7 Answer(s)
  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Hi @ageiter

    For the BreadCrumbs; When you add LeptonX, it automatically disables breadcrumbs on PageHeader and renders its own breadcrumbs at the top of the page

    So, the only way to remove breadcrumbs for leptonx is replacing the Breadcrumbs component so far.

    It is Breadcrumbs.razor from the Volo.Abp.AspNetCore.Components.Web.LeptonXTheme.Components.ApplicationLayout.Common namespace You can read how to replace a component on blazor from here


    For the MobileMenuSelector:

    It seems it's working on the latest release. I just created a new project and add the following configuration from your sample:

            Configure<LeptonXThemeBlazorOptions>(options =>
            {
                options.Layout = LeptonXBlazorLayouts.TopMenu;
                options.MobileMenuSelector = items => items.Where(x => x.MenuItem.Name == Support5890Menus.Home);
            });
    

    And it rendered only Home page (Same constant from the MenuContributor.)

    If there is another specific-case, please share the steps with us

  • User Avatar
    0
    ageiter created

    Hi @enisn

    Thanks for your reply.

    Please be sure to write such things in the documentation if any options do not work for LeptonX. When I look at this page in the documentation, I would never get the idea that this only applies to the Basic Theme. Because there is the sentence "The Basic Theme currently doesn't implement the breadcrumbs." in there, I would assume that breadcrumbs don't exist there and then this option wouldn't make sense. Do you know what I mean?

    With which version did you do the test with the MobileMenuSelector? 7.3.3 or newer?

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Thanks for you feedback, I'll make sure this information is included in the documentation to prevent future problems 🙏

    With which version did you do the test with the MobileMenuSelector? 7.3.3 or newer? I've tried with the 7.4.0-rc.5 version too and it works as same as stable 7.3.3 version

  • User Avatar
    0
    ageiter created

    I found the problem in the configuration of the MobileMenuSelector:

    Not working: options.MobileMenuSelector = items => items.Where(x => x.MenuItem.Name == "Home");

    Working: options.MobileMenuSelector = items => items.Where(x => x.MenuItem.Name == MyProjectName.Home);

    Since the MenuItem.Name is composed of Prefix + ".Home", it does not work with just "Home".

    Actually I should have noticed this earlier, but I took the code from the documentation and did not suspect the fault there.

    Please correct the documentation accordingly here for MVC and here for Blazor

    Thanks.

  • User Avatar
    0
    ageiter created

    Hi enisn, can you update the documentation accordingly? Then I will close this ticket.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi https://github.com/abpio/abp-commercial-docs/pull/627

  • User Avatar
    0
    ageiter created

    @liangshiwei: I think your change is not yet correct. You wrote the following:

    options.MobileMenuSelector = items => items.Where(x => x.MenuItem.Name == "MyProjectName.Home" || x.MenuItem.Name == "MyProjectName.Dashboard");

    However, it would be correct to use the constants and not strings.

    options.MobileMenuSelector = items => items.Where(x => x.MenuItem.Name == MyProjectName.Home || x.MenuItem.Name == MyProjectName.Dashboard);

Made with ❤️ on ABP v9.1.0-preview. Updated on November 01, 2024, 05:35