YUI recommends YUI3.
YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.
This documentation is no longer maintained.
As with the Folder Style example, here we're using CSS to control the styling of our TreeView Control's node icons. The CSS and image assets for the Menu Style are available as part of the YUI download package.
This example also implements MenuNode
instead of TextNode
for node creation. Only one MenuNode
can be open at a given depth at the same time. This creates an interaction in which nodes close up behind you as you open new ones, keeping the vertical size of the TreeView more compact during navigation.
The key change we've made in this TreeView Control example is that we've applied a supplementary CSS file to create the "Menu Style" node presentation:
This CSS redefines the look of branch nodes so they appear as arrows. The folder-style CSS accompanies your YUI download and can be found in the yui/examples/treeview/assets
directory.
Beyond the link
element referenced above, the following markup is on the page for this example:
Based on that markup, we use the following JavaScript code to create our TreeView instance, populate its nodes, and add expand/collapse functionality:
Note: You are viewing this example in debug mode with logging enabled. This can significantly slow performance.
All YUI 2.x users should review the YUI 2.8.2 security bulletin, which discusses a vulnerability present in YUI 2.4.0-2.8.1.
Copyright © 2013 Yahoo! Inc. All rights reserved.