Feather's sfTree directive enables you to display items hierarchically and provides you with the functionality to retrieve the selected item. You can use the directive to display hierarchical tree in the frontend, as well as in the backend. For example, on a page, as well as in a widget designer.
For more information, see Feather: Use content selectors outside of widget designer views.
The sfTree is a directive with an isolated scope that is defined in a module with the same name: sfTree.
For more information, see Isolating the Scope of a Directive.
The sfTree directive exposes the following attributes:
The following example demonstrates how to add a generic tree directive in a widget designer's view.
To enable AngularJs to link the sfTree directive in your custom designer view, you must load the script of the directive and add a dependency to the module.
Perform the following:
The code above is invoked during the initial load of the sfTree directive and two root elements are added to the tree. If you select an item which is a parent, the tree expands and invokes the function. As a result, two more elements are added under the currently selected node.
If the sf-has-children-field attribute is present, its scope variable is evaluated. If the attribute is not present, all elements of the tree visually appear as if they have children. If you try to expand such an element, the response is an empty array and the item no longer appears as a parent.
To provide notification when an item is selected the sfTree directive emits a custom selection event. To subscribe to the selection event, use the code in Step 2 of the above procedure.
Back To Top
Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.