aftertreedata
This article is about the aftertreedata UDB event handler.
aftertreedata
The aftertreedata event may be called from web pages developed in Web Designer and processed by a USoft page engine service.
| Event | Applies to | Occurs when |
|---|---|---|
aftertreedata | Data source objects bound to a Tree control's root or branch nodes | After the data for a tree's root or a tree branch has been fetched (or the fetch has failed) and the corresponding showdata processing has run |
This event is triggered on the data source object (ds/dsc) of a tree's root or branch nodes by the TreeControl class (defined in controls/tree-control.js, a subclass of DataControl), from three places: TreeControl.query(), used when the tree is first filled; the refreshtree event handler, used when a branch is refreshed; and the openfolder event handler, used when a branch is expanded and its children need to be queried. In every case, aftertreedata fires right after the tree's data has been retrieved (whether the query succeeded or failed) and is effectively the "data for this part of the tree is now settled" counterpart to showdata, fired specifically for tree data sources. There is no other consumer of this event anywhere else in the code base — it exists purely as a notification hook for Web Designer event scripting.
Purpose
You can use this event to run code once the data for a portion of the tree has finished loading, for example to update a counter, hide a loading indicator that your own script added, or perform additional client-side processing that depends on the tree's rows being present.
How to use
Find or create an Event Listener object with Event Type = aftertreedata. Event Listeners are in the Web Designer Controls catalog:
Insert the event listener into the data source object of the Tree control (or of the relevant tree node). Insert a callClientScript action into the event listener. Use this action's Script property to code the behaviour that you want to see when the event occurs.
You are implicitly associating the event with an event handler function. This function has an options parameter. For available options, see the Options section at the end of this help topic:
function(*evt*, *options*){ ... }
Or you can create the event handler more explicitly by calling $.udb('data-source').on().
No options object is passed to the event handler function; the event is a plain notification that the tree's data is now available.