Error in loading tree of dojo, error in loading tree of dojo

Source: Internet
Author: User

Error in loading tree of dojo, error in loading tree of dojo

1. Error description

Error loading undefined children.

TypeError: this. _ arrayOfTopLevelItems is undefied.


2. Error cause


3. Solution


How can I expand all the nodes in the dojo tree when the page is opened?

A problem occurs: How to expand all nodes in the dojo tree? Because struts2 is the default dojo, what should I do if I want to implement dojo to expand all nodes at a time?

After turning around on google, I only asked questions and did not solve them. So I had to do it myself. Fortunately, after some brain cells struggled, I went out and shared it with everyone. I also accepted criticism from everyone:

Dojo. addOnLoad (function (){

Dojo. widget. byId ('treetestid ');

ExpandObj (myObj );

});

Function expandObj (obj ){

If (obj ){

If (obj. children ){

For (var I = 0; I <obj. children. length; I ++ ){

Var childObj = obj. children [I];

If (childObj ){

Try {

ChildObj. expand ();

} Catch (e ){

}

If (childObj. children ){

ExpandObj (childObj );

}

}

}

}

}

}

Click events in the dojo tree

You can operate a single node dijit/Tree. _ TreeNode or the entire Tree.
For more information, see the official dojo documentation. Dojotoolkit.org/api/
Open dijit --- Tree. Click in the document that appears on the right
Event Summary
All kinds of events have
Method Summary
There are also various methods for the tree.

See the dijit/Tree reference documentation for more information ..
Click it to see the detailed example. That is, dojotoolkit.org/..e.html.
All of them are very detailed. You do not need to refer to other articles after reading the documents.

By the way, if some browsers cannot run the sample program on the website, you can try another browser.

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.