javascriptjqueryweb2pyjstreejqwidget

jsTree contextmenu not presenting on tree-node when RMB clicked


I have a website.

It has two pages.

pg1 is just for me to work with jsTree in a simple environment. Things are working fine here.

pg2 is the production application. Here is where I am having this issue.

The same code is in both pages and jsTree works fine for all other purposes. I built the tree up from scratch and now what to add only one context menu item.

The #1 difference is my production page jsTree is hosted in a jqWidget jqxWindow.

Both pages are hosted on python-web2py, but the demo page really isn't a web2py page. The demo does go through the web2py controller but the page is straight html/doesn't include the web2py javascript framework or view objects. And if I view source on the demo page it is almost exactly as I see it in my editor.

All that said I don't what to lead you to the opinion that the jqxWidgets or web2py is the root of this problem.

.

This is the code in question and is the same in both pages.

, 'contextmenu': {
    'items': function (node) {
        var tmp = $.jstree.defaults.contextmenu.items();
        delete tmp.rename;
        delete tmp.remove;
        delete tmp.ccp;
        tmp.create.label = "New Folder";
        return tmp;
    }
}
, 'plugins': ['contextmenu']

.

When I click on jsTree's nodes in the demo page everything is fine.

The problem is when I click on jsTree's nodes in the production page nothing happens. Nothing at all. The context menu doesn't render/appear in the browser. It is as if the production jsTree doesn't hear the RMB click.

EDIT: I just came to realize this too. Anywhere on the page the RBM click brings up the browsers standard context menu .... Except on the jsTree nodes. On the nodes- nothing. This tends to lead me believe it has nothing to do with jqWidgets or web2py.

What could be blocking the jsTree from presenting the context menu? Could I be missing from style elements? Is there some contextmenu.js file the production page isn't getting?

If you do think jqWidgets or web2py could be root of this


Solution

  • Since you successfully get the test message in the console, my guess is that the context menu is there, only not visible.

    The context menu would be an ul element with class vakata-context jstree-contextmenu jstree-default-contextmenu. It is added when you right-click the mouse on the node and then removed when you click outside it. Try right clicking it and then searching for that menu element in the DOM (Elements console tab).