Jstree Tree Menu Issues

Source: Internet
Author: User

Stree is a powerful tree-shaped page. But there are a lot of pits. Because my English level is poor, the above are all English comments, I write a memo

Introduce JS file. This online lot

I introduced the JSON data format to

$json = ' [
{
"id": "Ajson1",
"Parent": "#",
"Text": "Simple root node"
},
{
"id": "Ajson2",
"Parent": "#",
"Text": "Root Node 2"
},
{
"id": "Ajson3",
"Parent": "Ajson2",
"Text": "Child 1"
},
{
"id": "Ajson4",
"Parent": "Ajson2",
"Text": "Child 2"
}
]‘;

There are 3 pits here.

1. The ID of the child cannot overlap with the ID of the parent. This will not show all, I use the method is the parent ID is unique, the child ID I use the other to spell up, and then n=0;n++; Because the data i want here is just text.

2. The key value of the child must be 0.1.2.3.4 ... Such a type, if it is missing one, the back will not be shown, because I have the first data is empty, so I delete the array first data, the method is to re-"array_values"-This is the way PHP re-defines the array

3. If I'm going to destroy the tree before this time, create a new one. Use $.jstree.destroy (' #jstree '); This is written in the front of JS. Destroy in kind, haha, I have a bug here I do not understand you will not encounter, if destroyed, before the binding event on GG, But you can write it like I did, and I got it. Though I don't quite understand the reason

Jstree Tree Menu Issues

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.