Working with the Dojo Tree Widget
I’m working with another powerful widget from Dojo: the Dojo tree widget. I’ll continue to post some "hands-on documentation" like that I did with Dojo’s FisheyeList Widget. Here’s a quick tip off that bat that’s not readily apparent.
If you want your tree to be expanded when it loads (instead of showing the top level container only), you’ll need to make use of the expandLevel property. Here’s how it looks in code:
By specificing an expandLevel of 2, we tell the widget we want the top level container expanded to expose its children on load, the behavior you’d get if you clicked the expansion icon for the top level container. 1 is the default expandLevel; it shows the parent and nothing beneath it. These levels increase (expandLevel="3", expandLevel="4") to accomodate initially expanding your Tree to whatever depth you’d like.
technorati tags:dojo, dhtml, javascript, tree, widget