Using Ajax with an Unlevelled List
When using an unlevelled list, it is possible to define just a partial list and to have the Tree View fetch further entries at a future time if and when they are needed. This technique can be useful for particularly large tree structures that might slow down the initial loading and rendering of the page.
To use this technique, you should add a "has children" field to your working list. This field (a single-byte field that should contain a Y or N) tells the Tree View to draw the item as an expandable node even if it has no children.
When the user expands a node that has no children the Tree View will call a webroutine to request a fresh copy of the working list containing new entries to add to the tree. The webroutine used for this purpose is defined with the onexpand_wamname/onexpand_wrname properties. The webroutine does not need a user interface as the Tree View will automatically request a JSON response from it.
Two fields and a list are sent to the webroutine.
Field |
Tree View Property |
Description |
ID |
The ID of the expanded item |
|
Level |
The level of the expanded item |
|
Ancestors |
A list containing the ancestors of the expanded item. The list will contain a single field which will be the same as the ID field of the working list used to create the tree. |
While the properties above allow you to specify what fields the information is put into, you still need to define those fields in the WEB_MAP for the onsubmit webroutine.