diff --git a/Bench4Q-Web/src/main/webapp/script/editor/jstreeFactory.js b/Bench4Q-Web/src/main/webapp/script/editor/jstreeFactory.js index 5d6fca17..a2628a93 100644 --- a/Bench4Q-Web/src/main/webapp/script/editor/jstreeFactory.js +++ b/Bench4Q-Web/src/main/webapp/script/editor/jstreeFactory.js @@ -19,7 +19,7 @@ function jstreeCreateNode(containerId,data,name,id,pos){ childNode = ref.create_node(parentNode,{text:name,id:id,data:data,type:"default"},pos); if(childNode) { ref.open_node(parentNode); - ref.select_node(childNode); + jstreeSelectNode(containerId,childNode); } } @@ -34,6 +34,16 @@ function jstreeDeleteNode(containerId){ return ref.element.context.id; } +/** + * @param containerId the id of jstree container + * @param node the id of to be selected node + */ +function jstreeSelectNode(containerId,node){ + var ref = $("#"+containerId).jstree(true); + ref.deselect_all(); + ref.select_node(node); +} + /** * @param containerId the id of jstree container