Summary of Jstree Usage

Source: Internet
Author: User

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_childrenThe child tree that the current node has at most. Do not set or set to-1 to represent infinity.
    • max_depthThe 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_childrenAn array consisting of a string. Represents these string types can contain child nodes. Not set or set to-1 for infinity.
    • iconA 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.
    • defaultAll 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.