Tree view fields can be used only in windows. They can’t be stored in tables, so you must add nodes to the tree view each time it is displayed. Two common methods are used to add nodes to a tree view field: preloading all nodes or preloading the root-level nodes and then dynamically adding child nodes as needed.
For tree view fields that contain fewer than 100 nodes, using the window pre script to add all of the nodes provides acceptable performance. If the tree will contain more than 100 nodes, the window loading time could become unacceptably long. If this is the case, you should consider preloading only root-level nodes, described in the following paragraph.
If a tree view field will contain more than 100 nodes, we recommend that you preload only the root-level nodes using the window pre script. Then use the expand and collapse scripts for the tree view field to dynamically add and remove child nodes from the tree. We recommend removing nodes with the collapse script because even though the collapsed nodes aren’t being displayed, they degrade performance of the tree.
Dynamically adding and removing nodes has some additional benefits: