The WTreeNode class is a flexible building blocks for
creating a hierarchical tree. Through specialization, the tree
contents can be customized to contain abitrary widgets.
The tree supports several options for progressively loading the
tree contents, and all expand/collapse behaviour is optimized to
client-side when JavaScript is available (although the entire tree
is implemented purely in C++).
The WTree class manages a hierarchy of
WTreeNode nodes, and provides support for single or
multiple selection.
This example also uses a small class called WIconPair, which provides an easy interface
to showing one of two icons.
The flexibility of the WTree class comes at a cost (in
terms of client-side and server-side resources). In many cases,
the WTreeView class may be
more suitable for displaying large data models, using a MVC
(Model-View-Controller) approach.
Related topics: WTreeView.