5.3.9 <al-tree>

This tag is used to display tree structured data. During execution the tag performs an pre-order traversal (node visited before each child) of the tree returned by the expr attribute.

The lazy attribute allows lazy traversal of the tree, with child nodes only being loaded when their parent is open. The ellipsis attribute extends this further, collapsing nodes close to the root of tree as deeper nodes are opened. Special attributes on the <al-input> tag allow the user to open, close, and select lazy tree nodes (see page in section 5.2.2).

An instance of TreeIterator class (or the sub-classes LazyTreeIterator or EllipsisTreeIterator) will be placed into the execution context using the name specified in the iter attribute. This iterator will contain traversal data for the current node each time the tag content is executed. Note that it is also acceptable to create an instance of one of the TreeIterator classes prior to rendering the template. The set_selected_aliases or set_open_aliases methods can then be used to render the tree with nodes already selected or open.

Section 3.12 contains an example of a simple usage of the <al-tree> tag.

The samples/tree/tree1 sample program takes the simple example further and implements an application that places a checkbox next to the name of each node name. A unique input field name is generated for each checkbox by using the alias attribute described in section 5.2.2 on page .

The samples/tree/tree2 sample program demonstrates the use of the lazy <al-tree> attribute that enables lazy child loading mode.

The samples/tree/tree3 sample program demonstrates the use of the ellipsis <al-tree> attribute.


Subsections