vakata / jstree

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

Context menu icons #2621

Closed sdusa-o closed 2 years ago

sdusa-o commented 2 years ago

When I use the default context menu, there are no icons for Cut, Copy, Delete and so on. There is space on the left side, but no icons. How do I add/enable those icons? Thanks.

image

stla commented 2 years ago

I don't know for the default context menu. If you use a custom context menu, you have to set the icon option, e.g.

contextMenu = {
  items: function customMenu(node) {
    var tree = $("#mytree").jstree(true);
    var items = {
      rename: {
        label: "Rename",
        action: function (obj) {
          tree.edit(node);
        },
        icon: "glyphicon glyphicon-edit"
      },
      delete: {
        label: "Delete",
        action: function (obj) {
          tree.delete_node(node);
        },
        icon: "glyphicon glyphicon-trash"
      },
      create: {
        label: "Create",
        action: function (obj) {
          tree.create_node(node);
        },
        icon: "glyphicon glyphicon-plus"
      }
    };
    return items;
  }
};
vakata commented 2 years ago

Thank you @stla

smahn9123 commented 1 year ago

How can I remove the empty space? I don't need an icon or its space left behind.

It seems $.vakata.context.icons should be false. How can I do that from outside?

        $.vakata.context = {
            settings : {
                hide_onmouseleave   : 0,
                icons               : true
            },