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

Dynamic submenus and/or Destroy PopMenu #1

Closed
nicollasricas opened this issue Jun 22, 2016 · 2 comments
Closed

Dynamic submenus and/or Destroy PopMenu #1

nicollasricas opened this issue Jun 22, 2016 · 2 comments
Labels

Comments

@nicollasricas
Copy link

nicollasricas commented Jun 22, 2016

Hi,

Is there a way to create dynamic submenus or destroy the popmenu then I could rebuild entirely?

Nice plugin.

Have a nice day
Thanks

@nicollasricas nicollasricas changed the title Dynamic submenus Dynamic submenus and/or Destroy PopMenu Jun 22, 2016
@fujaru
Copy link
Owner

fujaru commented Jun 23, 2016

Hi,

Thanks for using PopMenu plugin!

To create dynamic submenu you could first create a PopMenu instance and assign it to 'submenu' option on a PopMenuItem. For example:

$(elm).popmenu({
    item1: {label: 'New'},
    item2: {label: 'Open'}
});

var newSubmenu = new PopMenu({
    newFile: {label: 'Blank File'},
    newPng: {label: 'Image File (png)'},
    newDoc: {label: 'Text Document (doc)'},
    newXls: {label: 'Spreadsheet (xls)'}
});
$(elm).popmenu().find('item1').options({ submenu: newSubmenu });

Currently there is no method to destroy or reassign an element to different popmenu. I will open a separate ticket to track this.

Hope it helps. Have a nice day!
Fajar

@nicollasricas
Copy link
Author

Sorry for late reply!

That helps, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants