Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting menu prop of standalone (unowned) MenuItem throws error #8371

Open
ExtAnimal opened this issue Jan 28, 2024 · 0 comments
Open

Setting menu prop of standalone (unowned) MenuItem throws error #8371

ExtAnimal opened this issue Jan 28, 2024 · 0 comments
Labels
bug Something isn't working forum Issues from forum large-account Reported by large customer OEM OEM customer

Comments

@ExtAnimal
Copy link

Forum post

Hi!

I need some help with one situation. I'm creating a dynamic menu, with information from the backend of my application. But it is giving me an error that I replicated with the menu sample of the documentation.

I know the creation is out of a normal order but is the way the menu must be created. Any workaround will help!

const itemSubMenu = new MenuItem(
        {
            text : 'Sub menu',
        });

const subMenu = new Menu(
            {
                icon : 'b-fw-icon b-fa-play',
                text : 'Play'
            });

itemSubMenu.menu = subMenu;

const menu = new Menu({
    anchor   : true,
    autoShow : false,
    items    : [
        {
            icon : 'b-fw-icon b-icon-add',
            text : 'Add'
        },
        {
            icon : 'b-fw-icon b-icon-trash',
            text : 'Remove'
        },
        {
            icon     : 'b-fw-icon b-icon-lock',
            disabled : true,
            text     : 'I am disabled'
        },
		itemSubMenu
    ],
    // Method is called for all ancestor levels
    onItem({ item }) {
        Toast.show('You clicked ' + item.text);
    }
});

@ExtAnimal ExtAnimal added bug Something isn't working forum Issues from forum large-account Reported by large customer OEM OEM customer labels Jan 28, 2024
@matsbryntse matsbryntse self-assigned this Jan 28, 2024
@matsbryntse matsbryntse removed their assignment Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working forum Issues from forum large-account Reported by large customer OEM OEM customer
Projects
None yet
Development

No branches or pull requests

2 participants