From e92560e3a8d06a69dabf4441e0b003a1878098eb Mon Sep 17 00:00:00 2001 From: luqiong <605601787@qq.com> Date: Wed, 20 Aug 2014 10:45:38 +0800 Subject: [PATCH] merge jstreeFactory --- .../main/webapp/script/editor/jstreeFactory.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Bench4Q-Web/src/main/webapp/script/editor/jstreeFactory.js b/Bench4Q-Web/src/main/webapp/script/editor/jstreeFactory.js index 8c1f8258..3e3cbeb5 100644 --- a/Bench4Q-Web/src/main/webapp/script/editor/jstreeFactory.js +++ b/Bench4Q-Web/src/main/webapp/script/editor/jstreeFactory.js @@ -1,6 +1,6 @@ /** * @param containerId the id of jstree container - * @param data something + * @param data * @param name the name of new node * @param id the id of new node * @param pos the position of new node to the parent node,maybe "last" which means the childnode of the selected @@ -19,6 +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); + //jstreeSelectNode(containerId,childNode); } } @@ -33,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 @@ -73,4 +84,5 @@ function jstreeCreate(containerId){ ref.select_node(data.node); } }) -} + return $("#"+containerId).jstree(true); +} \ No newline at end of file