1c1634ecde5730e83e599863eb4455d97cf80cd4 chmalee Wed Sep 25 09:45:03 2019 -0700 Fixing two bugs with hub searching, one where I forgot to htmlEncode a result and one where I was preventing single click expand of the results tree, refs #23812 diff --git src/hg/js/hgHubConnect.js src/hg/js/hgHubConnect.js index c8c5e15..5a5ad60 100644 --- src/hg/js/hgHubConnect.js +++ src/hg/js/hgHubConnect.js @@ -78,57 +78,55 @@ } }); } } function buildTracks(node, cb) { // called when jstree wants data to open a node for the tracks tree cb.call(this, trackData[node.id]); } function init(searching) { $.jstree.defaults.core.themes.icons = false; $.jstree.defaults.core.themes.dots = true; $.jstree.defaults.contextmenu.show_at_node = false; if (searching === true) { - console.log("special build"); $.jstree.defaults.contextmenu.items = hubSearchTreeContextMenuHandler; $('div[id^="tracks"]').each(function(i, obj) { treeDiv = obj; var hubId = treeDiv.id.slice(6); arrId = '#_' + hubId; $(treeDiv).jstree({ 'plugins' : ['contextmenu'], 'core' : { 'data': function(node, cb) { if (node.id === '#') { cb([{"text" : "Search details ...", "id": arrId, "children": true}]); } else { cb(trackData[""+node.id]); } }, 'dbclick_toggle': false } - }) - .on('select_node.jstree', function(e, data) { - $(e.target).instance.open_node(data.node); + }); + $(treeDiv).on("select_node.jstree", function (e, data) { + $(e.target).jstree("open_node", data.node); }); // jstree }); // each div } else { // validating hub, no contextmenu and easier tree building - console.log("regular trackData build"); treeDiv = $('#validateHubResult'); treeDiv.jstree({ 'core' : { 'data' : buildTracks, 'dbclick_toggle': false } }); treeDiv.on('select_node.jstree', function(e, data) { - $(e.target).instance.open_node(data.node); + $(e.target).jstree("open_node", data.node); }); } } // init return { init: init }; }());