The Jstree is a powerful plug-in. Official Address http://www.jstree.com/
$ (' #jstree '). Jstree ({"core": {"Ani Mation ": 0," Themes ": {" dots ": true," Icons ": true," Stripes ": false}," Chec K_callback ": True," multiple ": false, ' data ': Data}, "Types": {"#": {"Max_children": 5, "max_depth": One,}, "default": {"icon": "false", "Valid_children": ["Default", "Text"]}, "text": { "Icon": "false", "Valid_children": []} }, "Plugins": ["State", "types", "Wholerow"]});
The $.jstree.defaults.core level has many APIs that can be set at initialization time.
If the hierarchy of the tree is required, especially if the leaf node as a document, the parent node as a folder such as the requirements of the type to be set.
-------------------------------------------------------------------------------------------------
max_children
The child tree that the current node has at most. Do not set or set to-1 to represent infinity.
max_depth
The maximum number of child nodes that the current node can contain. If 1 represents a child node, there is no grandson node. Do not set or set to-1 to represent infinity.
valid_children
An array consisting of a string. Represents these string types can contain child nodes. Not set or set to-1 for infinity.
icon
A string, which can be either a path or a classname. If you use IMG under the current directory, the path is set to./xxx.png, otherwise it will be configured as class. If omitted, the default icon will be used as your theme.
There is predefined types:
#
Represents the ID of the root node.
default
All properties that are not set are followed by default.
-------------------------------------------------------------------------------------------------
In types, I set the deepest level for # 11, gave default a child node that can have default and text, and set the text child node to null. This creates a new text node and no more child nodes can be created.
Because the project requires no icon, the icon is set to False.
The project requires the folding tree to be set to + and-sign, we can change STYLE.MIN.CSS's jstree default CSS file, insert our own picture. Its default icon is placed in a large picture, through the background position to locate. Be careful with the icon and the folded picture together, changing one of them may affect the other. You can add some CSS source file code according to the class they are in.
Plugins is the Jstree plug-in array. Its plug-in can implement drag and drop functions. Add the plug-in into this array to do it.
--------------------------------------------------------------------------------------------------
Create,rename,remove,upmove,downmove
var ref = $ (' #jstree '). Jstree (true),
Ref is to get the whole jstree (don't know how to describe ...) Many of the APIs have to start with ref);
Ref.get_node (SEL) Get SEL node
Ref.delete_node (sel); Delete node
sel = Ref.create_node (sel, {"type": "Text"}); New node