vakata / jstree

jquery tree plugin
http://jstree.com
MIT License
5.15k stars 1.38k forks source link

Possibility to add a hidden option on contextmenu items #2600

Closed minedun6 closed 2 years ago

minedun6 commented 2 years ago

Hi, is it possible to add a hidden option to the menu items of a context menu, based on boolean/closure ? Eg:

{
  label: "Label 1",
  disabled: false,
  hidden: true,
  hidden: function (data) {
       return false;
  },
  separator_before: true,
  separator_after: false,
  action: function (data) {
      // do something
  }
vakata commented 2 years ago

No, this is not possible but the whole contextmenu option can be set to a function - in that case you can control which items are shown depending on which node was selected - that should be more than enough for what you need.