This sample demonstrates how you can use client-side JavaScript to populate the WebObjectTree children items.
To support this feature, WebObjectTree uses the following client-side method:
function cwotOnBeginRequest(controlId, requestPath)
This is a callback method that needs to be implemented by you.
WebObjectTree will automatically detect the presence of this method, and call it whenever data is needed for children items.
The parameters are:
- controlId - the control identifier of the WebObjectTree instance.
- requestPath - the path to the data required for the expanded item object.
If the data is available, it may be returned as a JSON string or JavaScript object.
If the data needs to be fetched, return
null and the data can be processed later by calling the following client-side method:
function cwotProcessResponse(controlId, responseData)
This method is implemented in the WebObjectTree library.
The parameters are:
- controlId - the control identifier of the WebObjectTree instance.
- responseData - the children item information as a JSON string or JavaScript object.
For demonstration purposes, the data for the root parent items are fetched immediately and all other children items simulate an asynchronous loading of the data.
In this sample the WebObjectTree is allowing you to select a datacenter server, organized by region, location and role.
Clicking the "Submit" button will display the full path for your selection below:
Click the "Reset" link to clear your selection.