JsTree contextual question

This should be a very simple question, but I cannot find the answer anywhere. I recently (like today) started using jsTree and I just got my first tree. I created an unordered list of only static text:

<ul>
  <li>one</li>
  <li>two</li>
  <li>three</li>
</ul>

My code for jsTree looks like this:

$(document).ready(function () {
        $("#demo1").bind("select_node.jstree",
                function(event, data) {
                    //DO SOMETHING WHEN A NODE IS CLICKED
                }).jstree();
});

Then I try to add a context menu. Using the following:

$(document).ready(function () {
        $("#demo1").bind("select_node.jstree",
                function(event, data) {
                    //DO SOMETHING WHEN A NODE IS CLICKED
                }).jstree({plugins: ["contextmenu"], contextmenu: {items: customMenu}});
    });

customMenu is a simple function that returns an object.

When I run the first code, I get my jsTree and it collapses and expands. When I execute the second one, the area where jsTree says “Loading ...” is all. If I right-click this word, I will get a menu.

Any suggestions?

, customMenu, (), , : - -rename - -  --  --copy  -- -- --delete

, , . - , , jQuery jsTree, . ?

+3
2

contextmenu , jstree .

:

$("#demo1").jstree(
{ 
    "plugins" : [ "contextmenu" ]
}

, .

+2

on select jstree. , . .

$("#demo1").jstree(
{ 
     "contextmenu":{
         items:{
              "LogicalNameForMenuItem":{
                     label: "DisplayNameForMenuItem",
                     action: function (node) {
                          <--Your code to handle the function goes here-->
                     } 
               }
          }
      },

      "plugins" : [ "contextmenu","crrm","ui" ]

});

.

, false

"contextmenu":{
         items:{
            create:false,
            remove:false,
            ccp:false
         }
}
+1

All Articles