question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add custom context menu item dynamically

See original GitHub issue

Is it possible to add context menu items after plugin initialization? Something like that

$tree.jstree().contextmenu.add(definition);

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
AaronNGraycommented, Apr 13, 2019

@vakata I would seriously suggest modifying jsTree’s source something like the following :-

$.jstree.defaults.contextmenu.items = { ... }
$.jstree.defaults.contextmenu.fn = function(o, cb) {
    return $.jstree.defaults.contextmenu.items;
}

And have the jsTree source call contextmenu.items if its a function otherwise call contextmenu.fn otherwise use the contextmenu.items object as a menu object. This would then give the best of all worlds.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dynamically Adding a Context Menu Item with a Click Handler ...
I have a list view with a context menu. I am looking to dynamically add an item which has a click event. As...
Read more >
Dynamically add custom context menu to the nodes - GoJS
I want to show context menu on the node displayed in the diagram as per its Name property. I looked into some samples...
Read more >
Dynamic Multi-level Context Menu With JavaScript - CSS Script
A simple, plain, multi-level context menu component implemented in vanilla JavaScript. No third-party framework and stylesheet required.
Read more >
Menus - Android Developers
To define the menu, create an XML file inside your project's res/menu/ directory and build the menu with the following elements: <menu>: Defines ......
Read more >
ContextMenu / How To / Change menu items dynamically
Change menu items dynamically in JavaScript ContextMenu control ... The items visible in the ContextMenu can be changed dynamically based on the target...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found