WTreeView [doc]

WTreeView example

This example illustrates the WTreeView widget. This widget is part of Wt's MVC widgets, and are an alternative to the WTree, and WTreeTable widgets which are not MVC.

The widget supports very large models by loading only the visible region (with some margin) in the browser. This results in low memory consumption (on client and server) and fast load times.

This example uses a WStandardItemModel to populate the tree table. As is demonstrated, various roles may be used to indicate text, icons, selectable items (through check boxes), and also URLs or internal paths.

Many aspects of the tree view widget are not illustrated here, such as the various supported selection behaviors and modes, and reacting to item click events.

Except for the selection of items, the view does not yet offer the possibility to modify the model. Together with more fine grained control of how to display the data through delegates, support for editing will be added in the near future.

Weather
Drink
Visited
Places
Europe
Belgium
Beer
Brussels
Beer
Leuven
France
Spain
Africa
1 of 1

The following example uses shows how you can use the first column as a row header, which does not scroll horizontally together with the other columns column. This is useful when the WTreeView contains a large number of auxiliary columns which cannot all be displayed simultaneously, and there is a need to keep the first column visible while scrolling through the columns horizontally.

Weather
Drink
Visited
Places
Europe
Belgium
Beer
Brussels
Beer
Leuven
France
Spain
Africa
1 of 1
Events will be shown here.