merge jstreeFactory

This commit is contained in:
luqiong 2014-08-20 10:45:38 +08:00
parent ea40313135
commit e92560e3a8
1 changed files with 14 additions and 2 deletions

View File

@ -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);
}