Description
The SelectTree widget allows users to select items from a tree-like structure efficiently, without the server having to generate the entire tree immediately.
Note: This widget is designed for use only with the \IPS\Helpers\Form\Node helper.
Options
placeholder
(String; optional; default 'Select')
Text to use as the placeholder when no items are selected.
multiple
(Boolean; optional; default false)
Are users allowed to select multiple items at once?
selected
(Mixed; optional; default false)
Defines the pre-selected items as a JSON object, or false if no items are selected yet.
url
(String; required)
The URL used to fetch child items via AJAX.
Events emitted by ips.ui.selectTree
nodeItemSelected
Triggered when the user selects an item in the menu. Emitted on all items in the menu.
Event data:
-
title
The text of the element within the selected item, that has the attribute data-role="nodeTitle" -
id
The ID of this item as specified by the data-id attribute on the item. Note: this is not the HTML id attribute.
nodeSelectedChanged
Triggered when the selection in the menu changes (i.e. items are either selected or unselected). Emitted on all items in the menu.
Event data:
-
selectedItems
Array containing the data-id attribute values of all currently-selected items.
nodeSelectionClosed
Triggered when the drop-down menu is closed. Emitted on the root data-ipsSelectTree element.
Report Guide