Tree JAVASCRIPT UI Component API

Tree Javascript API

Class

Tree

Treeview component is a user interface that is used to represent hierarchical data in a tree structure.

Selector

smart-tree

Properties

AallowDragEnables drag-and-drop functionality within the current tree structure. When this option is set to 'true', users can drag items from the current tree and drop them into another tree that has the allowDrop setting enabled. This facilitates moving or copying items between compatible trees using a drag-and-drop interface.
AallowDropEnables drag-and-drop functionality, permitting items to be dropped into this tree. The dropped items may originate from either within the current tree or from a different tree, supporting both intra-tree and inter-tree item transfers.
AanimationConfigures or retrieves the current animation mode. When set to 'none', all animations are disabled. Use this property to control whether animations are enabled, disabled, or set to a specific animation style or behavior.
AautoHideToggleElementAutomatically hides the tree's toggle arrow when the mouse pointer leaves the tree area, and displays the toggle arrow again when the mouse pointer enters the tree area. This provides a cleaner interface by only showing the toggle control when the user is actively interacting with the tree.
AautoLoadStateControls whether the component automatically loads its state (including filtering, sorting, expanded, and selected items) from the browser's localStorage. When enabled, any previously saved state is retrieved and applied to the component on initialization, allowing users to resume where they left off. Disabling this option prevents the component from loading state information from localStorage.
AautoSaveStateControls whether the component automatically saves its state—including filtering, sorting, expanded rows, and selected items—to the browser’s localStorage. When enabled, these settings are preserved and restored on page reload, providing a persistent user experience.
AautoSortControls whether the tree is automatically re-sorted after changes. When autoSort is set to false, any modifications made to an already sorted tree will not trigger an automatic re-sorting; you will need to manually sort the tree to update its order. If autoSort is true, the tree will automatically re-sort itself whenever its contents are modified.
DdataSourceSpecifies the data source from which the Tree component will retrieve and display its hierarchical data. This property determines which dataset is loaded and rendered within the Tree structure.
DdisabledControls whether the smartTree widget is enabled or disabled. When enabled, users can interact with the tree and perform standard operations; when disabled, all user interaction is blocked and the tree appears visually inactive.
DdisplayLoadingIndicatorControls the visibility of the loading indicator, allowing you to display it when a process is in progress and hide it when the process completes.
DdisplayMemberSpecifies which field in the data source should be used as the label for each item—this determines the display text shown to users for every item in lists, dropdowns, or other UI elements.
DdragFeedbackFormatFunctionA callback function that allows you to customize the HTML content displayed as drag feedback during a drag-and-drop operation. This function receives a single parameter: an array containing the items currently being dragged. Use this array to generate and return your custom HTML representation for the drag feedback.
DdragOffsetSpecifies the pixel offset of the drag feedback element relative to the mouse cursor during a drag operation. This value is defined as an array, where the first element represents the horizontal (X-axis) offset and the second element represents the vertical (Y-axis) offset. Adjusting these values changes the position of the visual feedback element in relation to the cursor as items are being dragged.
DdropDownModedropDownMode
DdropDownWidthSpecifies the width, in pixels, of the Tree component when it appears within a drop-down interface. Adjusting this value controls how wide the drop-down Tree is rendered, allowing for customization to fit various layouts or content requirements.
DdropDownHeightSpecifies the height of the Tree component when it is rendered within a drop-down menu. Adjusting this value determines how much vertical space the Tree occupies in drop-down mode, affecting the number of visible items before scrolling is required.
EeditableControls whether an item can be edited. When enabled, users can initiate editing by double-clicking a tree item or by selecting an item and pressing F2. If disabled, editing operations for the item are prevented.
EexpandModeSpecifies how TreeItemGroups within the Tree expand or collapse, controlling whether multiple groups can be expanded simultaneously, only one group can be expanded at a time, or all groups are collapsed by default. This setting defines the expand/collapse interaction pattern for grouped items in the Tree structure.
FfilterableControls the filtering functionality within the component. When enabled, a filter input field is displayed, allowing users to refine visible data based on their input. When disabled, the filter input is hidden, and all data items are shown without filtering options.
FfilterOnEnterTriggers the filter action exclusively when the 'Enter' key is pressed, ensuring that filtering occurs only after user confirmation rather than on every input change.
FfilterInputPlaceholderDefines a custom placeholder text to display within the filter input field, guiding users on what they can search or filter for.
FfilterMemberSpecifies which property of the TreeItem will be used as the filtering criterion. By default, the component filters using the label property of each TreeItem. You can change this behavior by setting the property to value to filter based on the value property, or to textContent to filter based on the textual content within the TreeItem. You may also specify any other valid property name to customize the filtering logic according to your data structure. This allows for flexible and precise filtering of TreeItems based on your application's requirements.
FfilterModeSpecifies the filtering method to be applied when processing data, such as selecting between different filter types (e.g., linear, nearest, or custom). Determines how input data is modified or constrained based on the selected filter mode.
HhasThreeStatesConfigures or retrieves whether the tree checkboxes support three distinct states: checked, unchecked, and indeterminate. This property is applicable only when the selectionMode is set to 'checkBox'. When enabled, the indeterminate state allows parent checkboxes to visually reflect that only some of their child nodes are selected.
IitemsMemberSpecifies the field in the data source that contains the collection of subitems associated with each item group. This property maps the hierarchical structure by identifying where the subitems data for each group is stored, enabling the component to correctly render nested or grouped elements.
LloadingIndicatorPlaceholderSpecifies a custom placeholder text to display within the loading indicator when the loadingIndicatorPosition property is set to either 'top' or 'bottom'. This allows you to personalize the message shown to users while content is loading in these positions.
LloadingIndicatorPositionSpecifies the location on the screen where the loading indicator will appear, such as 'top', 'bottom', 'center', or a custom position.
UunlockKeySets or retrieves the unlockKey value used to grant access to the product. The unlockKey acts as an authorization token or password that allows users to unlock and use the product’s features.
LlocaleSets or retrieves the current locale (language and regional settings) used by the component. This property works together with the messages property, which provides localized text and translations based on the selected locale. Use this property to display content in different languages and formats according to user preferences.
LlocalizeFormatFunctionCallback function associated with the localization module, typically used to handle events such as language changes, translation updates, or localization data loading. This function enables the application to respond dynamically to localization-related operations.
MmessagesDefines or retrieves an object containing the text strings displayed by the widget, enabling customization for different languages and regions. This property is used together with the locale property to provide localization support, allowing you to easily translate or adjust interface text based on the user's language settings.
OoverflowDefines the behavior of the scrollbar—or, when 'scrollMode' is set to ''scrollButtons'', the scroll buttons—when the content exceeds the visible area of the element. This setting determines how users can navigate overflow content, such as automatically displaying scrollbars, enabling scroll buttons, or applying custom overflow handling.
RreadonlyIf the element is set to readonly, users will be able to see its value but will not be able to modify, edit, or interact with its content in any way. The element will appear as non-editable, ensuring that its value remains unchanged by user input.
RrightToLeftSpecifies whether right-to-left (RTL) layout support is activated. When enabled, the user interface elements, text direction, and content flow are adjusted to accommodate languages that are read from right to left, such as Arabic or Hebrew.
SscrollModeSpecifies whether to display a traditional scrollbar or to use scroll buttons for navigating content when the element’s content exceeds its visible area. This setting controls the user’s method of scrolling in overflow situations.
SselectedIndexesA list (array) containing the index paths of the currently selected items. Each element in the array represents the hierarchical position of a selected item within the data structure, allowing precise identification of multiple selections.
SselectionDisplayModeSpecifies the visual style or method used to highlight selected items, such as changing their background color, border, or font style, to indicate their selection state to the user.
SselectionModeSpecifies how selections can be made within the component, such as allowing single selection, multiple selections, or no selection at all.
SselectionTargetSpecifies whether selection is enabled for smart-tree-items-groups, allowing users to select one or more groups within the tree component. When set to true, group items in the smartTree can be selected by user interaction.
SshowLinesDisplays or hides connector lines that visually represent the relationships between elements within a group, making it easier to understand how the elements are interconnected.
SshowRootLinesControls the visibility of connector lines between tree nodes, starting from the root node. When the 'showLines' property is set to true, lines connecting the hierarchical levels of the tree are displayed; if set to false, these lines are hidden.
SsortDefines a user-provided function to specify custom sorting logic. This function allows you to determine how items are ordered, overriding the default sort behavior. It receives two items as arguments and should return a value indicating their sort order.
SsortDirectionSpecifies the sort order to be applied, allowing values of either 'ascending' (arranging items from lowest to highest) or 'descending' (arranging items from highest to lowest).
SsortedControls whether sorting functionality is enabled or disabled for the data set. When enabled, users can sort items based on specified criteria or columns; when disabled, sorting is not available.
TthemeSets or retrieves the visual theme applied to the element, allowing you to customize its appearance (such as color scheme, style, or overall look) by selecting from predefined theme options.
TtoggleElementPositionSpecifies the position of the toggle element (such as an arrow) within the component, indicating where the toggle control will be displayed relative to the content (e.g., left, right, top, or bottom).
TtoggleModeControls how groups within smart-tree-items are expanded or collapsed. Specifies the toggle behavior for displaying or hiding group items in the smartTree component.
UunfocusableDetermines whether the element can receive keyboard focus. When set, the element is focusable using keyboard navigation (such as the Tab key) or scripting. This property can also be used to check the current focusable state of the element.
VvalueMemberSpecifies which field in the data source provides the value for each item. This property maps item values in your component or UI element to the corresponding field in your underlying data source, ensuring the correct value is referenced and displayed.

Events

CchangeThis event is triggered whenever the selected item(s) in the smart-tree component change. It occurs both when a user selects a new item or deselects a previously selected item, allowing developers to execute custom logic in response to changes in the tree's selection state.
CcollapseThis event is triggered whenever a smart-tree-items-group component is collapsed by the user. It occurs immediately after the group transitions from an expanded (open) state to a collapsed (closed) state, allowing you to execute custom logic in response to this action.
CcollapsingThis event fires immediately before a smart-tree-items-group collapses, providing an opportunity to intercept the action. Within the event handler, you can call event.preventDefault() to cancel the collapsing operation, preventing the group from being closed. This allows developers to implement custom logic—such as confirmation dialogs or validation checks—prior to the group’s collapse.
DdragEndThis event is triggered when a smart-tree-item or smart-tree-items-group element is dropped onto a target location within the DOM during a drag-and-drop operation. You can prevent the drop action from completing—effectively canceling the move—by calling event.preventDefault() within your event handler function. This allows you to implement custom logic to determine whether the drop should be allowed or denied.
DdraggingThis event is triggered when a smart-tree-item or smart-tree-items-group component starts being dragged by the user. It occurs at the moment the drag operation begins, allowing you to implement custom logic or UI feedback during the drag-and-drop interaction within the smartTree widget.
DdragStartThis event is fired when a drag operation begins within the smart-tree component. It allows you to intercept the initiation of the drag action. By invoking event.preventDefault() within your event handler, you can cancel the drag operation before it proceeds. This provides an opportunity to implement custom logic, such as conditional validations or user permissions, before allowing or preventing the drag from taking place.
EexpandThis event is triggered when a `smart-tree-items-group` element within the tree is expanded by the user, either through a mouse click or keyboard interaction. It allows developers to execute custom logic in response to the expansion of a specific group of items within the smartTree component.
EexpandingThis event is fired just before a smart-tree-items-group is expanded. At this stage, the expansion process has not yet occurred, allowing you to perform custom logic or checks. If you want to prevent the group from expanding, call event.preventDefault() within your event handler; this will cancel the default expand action.
FfilterChangeThis event is triggered whenever the selected item in the smart-tree component changes. It occurs after a user selects a different tree node, either through mouse interaction or keyboard navigation, allowing you to respond to selection changes within the tree.
OopenThis event is triggered each time the dropdown menu becomes visible to the user, such as when the user clicks on the dropdown or focuses on the dropdown field, causing the options list to appear. Use this event to perform actions whenever the dropdown is opened, such as loading options dynamically or tracking user interactions.
CcloseThis event is triggered whenever the dropdown menu is closed, either by user interaction (such as clicking outside the dropdown or selecting an option) or programmatically through the application logic. Use this event to execute any cleanup tasks or update UI elements that depend on the dropdown’s visibility state.
SscrollBottomReachedThis event is triggered when the user scrolls the Tree component all the way to its bottom edge, indicating that the last visible item in the Tree is fully displayed. You can use this event to implement features such as infinite scrolling, lazy loading, or displaying additional content as the user reaches the end of the Tree.
SscrollTopReachedThis event is triggered when the user scrolls the Tree component and reaches the very topmost position, indicating that no more content is available above within the scrollable area.
SswipeleftThis event is triggered when the user performs a leftward swipe gesture within the Tree component. It detects when the user places their finger or cursor on the Tree and moves it horizontally to the left, allowing you to handle custom interactions or navigation in response to this action.
SswiperightThis event is triggered when the user performs a rightward swipe gesture within the Tree component. It detects when a swipe action starts inside the Tree and moves in the right direction, allowing developers to implement custom behaviors in response to this specific user interaction.

Methods

AaddAfterInserts a new item immediately after a specified item within the same parent, making it a sibling element in the list or hierarchy.
AaddBeforeInserts a new item directly before a specified existing item within the same parent, making both items siblings in the data structure.
AaddToAppends a new item to the end of the specified parent item's list of children, making it the last child within the parent structure.
CclearSelectionRemoves any current selections, resetting the selection state to none. This action ensures that no items remain highlighted or marked as selected.
CcollapseAllCollapses all elements with the class smart-tree-items-group, ensuring that every expandable group within the tree component is minimized and any nested content is hidden from view. This action provides a streamlined overview of the tree by hiding detailed or child items under each group.
CcollapseItemCollapses the specified smart-tree-items-group, hiding all of its nested child items from view within the tree component. This action changes the group's state to collapsed, providing a more compact tree display by temporarily concealing its contents.
CcloseDropDownCloses the dropdown menu when the Tree component is operating in dropdown mode, ensuring that the dropdown is dismissed upon selection or when appropriate user interactions occur.
OopenDropDownDisplays the dropdown menu when the Tree component is set to dropdown mode, allowing users to interact with the tree structure within a dropdown interface.
EensureVisibleEnsures that a specified item is brought into the visible area of the scrollable container by automatically scrolling the container as needed, so the item is fully or partially in view for the user.
EexpandAllExpands all elements within the tree component that are assigned the 'smart-tree-items-group' class, making every group and its child items visible in the tree view.
EexpandItemExpands a specific group within the smartTree component, displaying all child items associated with the selected tree group. This action reveals the contents of a single smart-tree-items-group node, making its nested items visible to the user.
FfilterApplies a filter to the Tree component, displaying only the nodes that match the specified criteria while hiding all others. This helps users easily find and focus on relevant items within the tree structure.
GgetItemRetrieves a specific item by using either its unique identifier (ID) or a numeric path value. This function supports both string-based IDs and numeric paths to locate and return the corresponding item from the collection.
GgetFilterRetrieves the currently active filter, including its criteria and settings, that has been applied to the data set.
GgetSelectedValuesRetrieves the currently selected values from the component. If no value is explicitly set, the method returns the labels of the selected items instead.
GgetStateReturns the current state of the smartTree component, including information such as which nodes are expanded, collapsed, selected, or checked. This allows you to save or restore the tree’s structure and user interactions.
IinsertInserts a specified item into the array or list at the designated index, shifting subsequent items to the right to accommodate the new element. If the given position is out of range, an error may be thrown or the item may be added at the nearest valid position, depending on implementation.
LloadStateLoads and restores the current state of the Tree, including expanded or collapsed branches, selected nodes, and any custom configurations. This ensures the Tree appears as it was previously saved or last interacted with.
MmoveDownMoves the selected item one position lower in the order among its sibling elements, placing it directly after the next sibling in the list.
MmoveUpMoves the specified item one position higher in the list of its sibling items, effectively placing it before the previous sibling in the order.
RremoveItemRemoves a specified item from the collection or list. This operation locates the target item based on the provided identifier or criteria and deletes it from the data structure, ensuring that the collection is updated accordingly. If the item does not exist, no action is taken.
SsaveStatePersists the current state of the Tree structure, including all nodes, their expanded or collapsed statuses, and any selection information, allowing the Tree to be accurately restored in future sessions.
SselectAllows selection of an item either by specifying its numerical index in the list or by providing the item's unique HTMLElement ID. This enables precise targeting of elements for further operations.
SsetSelectedValuesSelects one or multiple items from a list based on their specified values. This allows you to programmatically choose which items are highlighted or marked as selected, using their corresponding value identifiers.
UunselectDeselects a specified item, either by providing its numeric index in the list or by passing the item's HTMLElement ID as a string.
UunselectValuesDeselects one or more items based on their specified values, removing them from the current selection set.
UupdateItemUpdates an existing item in the database with new values provided in the request. This operation locates the item by its unique identifier and applies the specified changes to its properties. Returns the updated item upon success.

Properties

allowDragboolean

Enables drag-and-drop functionality within the current tree structure. When this option is set to 'true', users can drag items from the current tree and drop them into another tree that has the allowDrop setting enabled. This facilitates moving or copying items between compatible trees using a drag-and-drop interface.

Default value

false

Example

Set the allowDrag property.

 <smart-tree allow-drag></smart-tree>

Set the allowDrag property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.allowDrag = false;

Get the allowDrag property.

 const tree = document.querySelector('smart-tree');
 let allowDrag = tree.allowDrag;

allowDropboolean

Enables drag-and-drop functionality, permitting items to be dropped into this tree. The dropped items may originate from either within the current tree or from a different tree, supporting both intra-tree and inter-tree item transfers.

Default value

false

Example

Set the allowDrop property.

 <smart-tree allow-drop></smart-tree>

Set the allowDrop property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.allowDrop = false;

Get the allowDrop property.

 const tree = document.querySelector('smart-tree');
 let allowDrop = tree.allowDrop;

animation"none" | "simple" | "advanced"

Configures or retrieves the current animation mode. When set to 'none', all animations are disabled. Use this property to control whether animations are enabled, disabled, or set to a specific animation style or behavior.

Allowed Values

  • "none" - animation is disabled
  • "simple" - ripple animation is disabled
  • "advanced" - all animations are enabled

Default value

"advanced"

Example

Set the animation property.

 <smart-tree animation='none'></smart-tree>

Set the animation property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.animation = 'simple';

Get the animation property.

 const tree = document.querySelector('smart-tree');
 let animation = tree.animation;

autoHideToggleElementboolean

Automatically hides the tree's toggle arrow when the mouse pointer leaves the tree area, and displays the toggle arrow again when the mouse pointer enters the tree area. This provides a cleaner interface by only showing the toggle control when the user is actively interacting with the tree.

Default value

false

Example

Set the autoHideToggleElement property.

 <smart-tree auto-hide-toggle-element></smart-tree>

Set the autoHideToggleElement property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.autoHideToggleElement = false;

Get the autoHideToggleElement property.

 const tree = document.querySelector('smart-tree');
 let autoHideToggleElement = tree.autoHideToggleElement;

autoLoadStateboolean

Controls whether the component automatically loads its state (including filtering, sorting, expanded, and selected items) from the browser's localStorage. When enabled, any previously saved state is retrieved and applied to the component on initialization, allowing users to resume where they left off. Disabling this option prevents the component from loading state information from localStorage.

Default value

false

Example

Set the autoLoadState property.

 <smart-tree auto-load-state></smart-tree>

Set the autoLoadState property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.autoLoadState = false;

Get the autoLoadState property.

 const tree = document.querySelector('smart-tree');
 let autoLoadState = tree.autoLoadState;

autoSaveStateboolean

Controls whether the component automatically saves its state—including filtering, sorting, expanded rows, and selected items—to the browser’s localStorage. When enabled, these settings are preserved and restored on page reload, providing a persistent user experience.

Default value

false

Example

Set the autoSaveState property.

 <smart-tree auto-save-state></smart-tree>

Set the autoSaveState property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.autoSaveState = false;

Get the autoSaveState property.

 const tree = document.querySelector('smart-tree');
 let autoSaveState = tree.autoSaveState;

autoSortboolean

Controls whether the tree is automatically re-sorted after changes. When autoSort is set to false, any modifications made to an already sorted tree will not trigger an automatic re-sorting; you will need to manually sort the tree to update its order. If autoSort is true, the tree will automatically re-sort itself whenever its contents are modified.

Default value

true

Example

Set the autoSort property.

 <smart-tree auto-sort></smart-tree>

Set the autoSort property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.autoSort = false;

Get the autoSort property.

 const tree = document.querySelector('smart-tree');
 let autoSort = tree.autoSort;

dataSource{label?: string, checked?: boolean, shortcut?: string, value?: any, selected?: boolean, items?: any[]}[]

Specifies the data source from which the Tree component will retrieve and display its hierarchical data. This property determines which dataset is loaded and rendered within the Tree structure.

Example

Set the dataSource property.

 <smart-tree data-source='[{ label: 'Cats', selected: true, items: [ { label: 'Tiger', selected: true }, { label: 'Lion' } ] }]'></smart-tree>

Set the dataSource property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.dataSource = [{ label: 'Cats', selected: true, items: [ { label: 'Tiger', selected: true }, { label: 'Lion' } ] }, { label: 'Dogs', expanded: true, items: [ { label: 'Gray wolf' }, { label: 'Ethiopian wolf', selected: true } ]}];

Get the dataSource property.

 const tree = document.querySelector('smart-tree');
 let dataSource = tree.dataSource;

disabledboolean

Controls whether the smartTree widget is enabled or disabled. When enabled, users can interact with the tree and perform standard operations; when disabled, all user interaction is blocked and the tree appears visually inactive.

Default value

false

Example

Set the disabled property.

 <smart-tree disabled></smart-tree>

Set the disabled property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.disabled = false;

Get the disabled property.

 const tree = document.querySelector('smart-tree');
 let disabled = tree.disabled;

displayLoadingIndicatorboolean

Controls the visibility of the loading indicator, allowing you to display it when a process is in progress and hide it when the process completes.

Default value

false

Example

Set the displayLoadingIndicator property.

 <smart-tree display-loading-indicator></smart-tree>

Set the displayLoadingIndicator property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.displayLoadingIndicator = false;

Get the displayLoadingIndicator property.

 const tree = document.querySelector('smart-tree');
 let displayLoadingIndicator = tree.displayLoadingIndicator;

displayMemberstring

Specifies which field in the data source should be used as the label for each item—this determines the display text shown to users for every item in lists, dropdowns, or other UI elements.

Default value

"label"

Example

Set the displayMember property.

 <smart-tree display-member='title'></smart-tree>

Set the displayMember property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.displayMember = 'caption';

Get the displayMember property.

 const tree = document.querySelector('smart-tree');
 let displayMember = tree.displayMember;

dragFeedbackFormatFunctionfunction | null

A callback function that allows you to customize the HTML content displayed as drag feedback during a drag-and-drop operation. This function receives a single parameter: an array containing the items currently being dragged. Use this array to generate and return your custom HTML representation for the drag feedback.

Example

Set the dragFeedbackFormatFunction property.

 <smart-tree drag-feedback-format-function='dragFeedbackFormatFunction'></smart-tree>

Set the dragFeedbackFormatFunction property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.dragFeedbackFormatFunction = function dragFeedbackFormatFunction(draggedItems) { return 'Dragging: ' + draggedItems[0].label; };

Get the dragFeedbackFormatFunction property.

 const tree = document.querySelector('smart-tree');
 let dragFeedbackFormatFunction = tree.dragFeedbackFormatFunction;

dragOffsetnumber[]

Specifies the pixel offset of the drag feedback element relative to the mouse cursor during a drag operation. This value is defined as an array, where the first element represents the horizontal (X-axis) offset and the second element represents the vertical (Y-axis) offset. Adjusting these values changes the position of the visual feedback element in relation to the cursor as items are being dragged.

Example

Set the dragOffset property.

 <smart-tree drag-offset='[0, 0]'></smart-tree>

Set the dragOffset property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.dragOffset = [-60, 20];

Get the dragOffset property.

 const tree = document.querySelector('smart-tree');
 let dragOffset = tree.dragOffset;

dropDownModeboolean

Default value

false
 <smart-tree drop-down-mode></smart-tree>

dropDownWidthnumber

Specifies the width, in pixels, of the Tree component when it appears within a drop-down interface. Adjusting this value controls how wide the drop-down Tree is rendered, allowing for customization to fit various layouts or content requirements.

Default value

300

Example

Set the dropDownWidth property.

 <smart-tree drop-down-width='null'></smart-tree>

Set the dropDownWidth property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.dropDownWidth = 200;

Get the dropDownWidth property.

 const tree = document.querySelector('smart-tree');
 let dropDownWidth = tree.dropDownWidth;

dropDownHeightnumber

Specifies the height of the Tree component when it is rendered within a drop-down menu. Adjusting this value determines how much vertical space the Tree occupies in drop-down mode, affecting the number of visible items before scrolling is required.

Default value

400

Example

Set the dropDownHeight property.

 <smart-tree drop-down-height='null'></smart-tree>

Set the dropDownHeight property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.dropDownHeight = 200;

Get the dropDownHeight property.

 const tree = document.querySelector('smart-tree');
 let dropDownHeight = tree.dropDownHeight;

editableboolean

Controls whether an item can be edited. When enabled, users can initiate editing by double-clicking a tree item or by selecting an item and pressing F2. If disabled, editing operations for the item are prevented.

Default value

false

Example

Set the editable property.

 <smart-tree editable></smart-tree>

Set the editable property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.editable = false;

Get the editable property.

 const tree = document.querySelector('smart-tree');
 let editable = tree.editable;

expandMode"multiple" | "single"

Specifies how TreeItemGroups within the Tree expand or collapse, controlling whether multiple groups can be expanded simultaneously, only one group can be expanded at a time, or all groups are collapsed by default. This setting defines the expand/collapse interaction pattern for grouped items in the Tree structure.

Allowed Values

  • "multiple" - Multiple TreeItemsGroups can be expanded at the same time.
  • "single" - Only one TreeItemsGroup from a group of siblings can be expanded.

Default value

"multiple"

Example

Set the expandMode property.

 <smart-tree expand-mode='single'></smart-tree>

Set the expandMode property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.expandMode = 'multiple';

Get the expandMode property.

 const tree = document.querySelector('smart-tree');
 let expandMode = tree.expandMode;

filterableboolean

Controls the filtering functionality within the component. When enabled, a filter input field is displayed, allowing users to refine visible data based on their input. When disabled, the filter input is hidden, and all data items are shown without filtering options.

Default value

false

Example

Set the filterable property.

 <smart-tree filterable></smart-tree>

Set the filterable property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.filterable = false;

Get the filterable property.

 const tree = document.querySelector('smart-tree');
 let filterable = tree.filterable;

filterOnEnterboolean

Triggers the filter action exclusively when the 'Enter' key is pressed, ensuring that filtering occurs only after user confirmation rather than on every input change.

Default value

false

Example

Set the filterOnEnter property.

 <smart-tree filter-on-enter></smart-tree>

Set the filterOnEnter property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.filterOnEnter = false;

Get the filterOnEnter property.

 const tree = document.querySelector('smart-tree');
 let filterOnEnter = tree.filterOnEnter;

filterInputPlaceholderstring

Defines a custom placeholder text to display within the filter input field, guiding users on what they can search or filter for.

Default value

""

Example

Set the filterInputPlaceholder property.

 <smart-tree filter-input-placeholder='Filter'></smart-tree>

Set the filterInputPlaceholder property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.filterInputPlaceholder = 'Filter Text';

Get the filterInputPlaceholder property.

 const tree = document.querySelector('smart-tree');
 let filterInputPlaceholder = tree.filterInputPlaceholder;

filterMemberstring

Specifies which property of the TreeItem will be used as the filtering criterion. By default, the component filters using the label property of each TreeItem. You can change this behavior by setting the property to value to filter based on the value property, or to textContent to filter based on the textual content within the TreeItem. You may also specify any other valid property name to customize the filtering logic according to your data structure. This allows for flexible and precise filtering of TreeItems based on your application's requirements.

Default value

"label"

Example

Set the filterMember property.

 <smart-tree filter-member='value'></smart-tree>

Set the filterMember property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.filterMember = 'textContent';

Get the filterMember property.

 const tree = document.querySelector('smart-tree');
 let filterMember = tree.filterMember;

filterMode"contains" | "containsIgnoreCase" | "doesNotContain" | "doesNotContainIgnoreCase" | "equals" | "equalsIgnoreCase" | "startsWith" | "startsWithIgnoreCase" | "endsWith" | "endsWithIgnoreCase"

Specifies the filtering method to be applied when processing data, such as selecting between different filter types (e.g., linear, nearest, or custom). Determines how input data is modified or constrained based on the selected filter mode.

Allowed Values

  • "contains" - displays only items with labels that contain the filter string (case sensitive)
  • "containsIgnoreCase" - displays only items with labels that contain the filter string (case insensitive)
  • "doesNotContain" - displays only items with labels that do not contain the filter string (case sensitive)
  • "doesNotContainIgnoreCase" - displays only items with labels that do not contain the filter string (case insensitive)
  • "equals" - displays only items with labels that equal the filter string (case sensitive)
  • "equalsIgnoreCase" - displays only items with labels that equal the filter string (case insensitive)
  • "startsWith" - displays only items with labels that start with the filter string (case sensitive)
  • "startsWithIgnoreCase" - displays only items with labels that start with the filter string (case insensitive)
  • "endsWith" - displays only items with labels that end with the filter string (case sensitive)
  • "endsWithIgnoreCase" - displays only items with labels that end with the filter string (case insensitive)

Default value

"containsIgnoreCase"

Example

Set the filterMode property.

 <smart-tree filter-mode='containsIgnoreCase'></smart-tree>

Set the filterMode property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.filterMode = 'doesNotContain';

Get the filterMode property.

 const tree = document.querySelector('smart-tree');
 let filterMode = tree.filterMode;

hasThreeStatesboolean

Configures or retrieves whether the tree checkboxes support three distinct states: checked, unchecked, and indeterminate. This property is applicable only when the selectionMode is set to 'checkBox'. When enabled, the indeterminate state allows parent checkboxes to visually reflect that only some of their child nodes are selected.

Default value

false

Example

Set the hasThreeStates property.

 <smart-tree has-three-states></smart-tree>

Set the hasThreeStates property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.hasThreeStates = false;

Get the hasThreeStates property.

 const tree = document.querySelector('smart-tree');
 let hasThreeStates = tree.hasThreeStates;

itemsMemberstring

Specifies the field in the data source that contains the collection of subitems associated with each item group. This property maps the hierarchical structure by identifying where the subitems data for each group is stored, enabling the component to correctly render nested or grouped elements.

Default value

"items"

Example

Set the itemsMember property.

 <smart-tree items-member='children'></smart-tree>

Set the itemsMember property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.itemsMember = 'subitems';

Get the itemsMember property.

 const tree = document.querySelector('smart-tree');
 let itemsMember = tree.itemsMember;

loadingIndicatorPlaceholderstring

Specifies a custom placeholder text to display within the loading indicator when the loadingIndicatorPosition property is set to either 'top' or 'bottom'. This allows you to personalize the message shown to users while content is loading in these positions.

Default value

"Loading..."

Example

Set the loadingIndicatorPlaceholder property.

 <smart-tree loading-indicator-placeholder='Chargement...'></smart-tree>

Set the loadingIndicatorPlaceholder property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.loadingIndicatorPlaceholder = 'Wird geladen...';

Get the loadingIndicatorPlaceholder property.

 const tree = document.querySelector('smart-tree');
 let loadingIndicatorPlaceholder = tree.loadingIndicatorPlaceholder;

loadingIndicatorPosition"bottom" | "center" | "top"

Specifies the location on the screen where the loading indicator will appear, such as 'top', 'bottom', 'center', or a custom position.

Allowed Values

  • "bottom" - positions the loading indicator at the bottom of the tree
  • "center" - positions the loading indicator at the center of the tree
  • "top" - positions the loading indicator at the top of the tree

Default value

"center"

Example

Set the loadingIndicatorPosition property.

 <smart-tree loading-indicator-position='bottom'></smart-tree>

Set the loadingIndicatorPosition property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.loadingIndicatorPosition = 'top';

Get the loadingIndicatorPosition property.

 const tree = document.querySelector('smart-tree');
 let loadingIndicatorPosition = tree.loadingIndicatorPosition;

unlockKeystring

Sets or retrieves the unlockKey value used to grant access to the product. The unlockKey acts as an authorization token or password that allows users to unlock and use the product’s features.

Default value

""

Example

Set the unlockKey property.

 <smart-tree unlock-key=''></smart-tree>

Set the unlockKey property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.unlockKey = '1111-2222-3333-4444-5555';

Get the unlockKey property.

 const tree = document.querySelector('smart-tree');
 let unlockKey = tree.unlockKey;

localestring

Sets or retrieves the current locale (language and regional settings) used by the component. This property works together with the messages property, which provides localized text and translations based on the selected locale. Use this property to display content in different languages and formats according to user preferences.

Default value

"en"

Example

Set the locale property.

 <smart-tree locale='de'></smart-tree>

Set the locale property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.locale = 'fr';

Get the locale property.

 const tree = document.querySelector('smart-tree');
 let locale = tree.locale;

localizeFormatFunctionfunction | null

Callback function associated with the localization module, typically used to handle events such as language changes, translation updates, or localization data loading. This function enables the application to respond dynamically to localization-related operations.

Example

Set the localizeFormatFunction property.

 <smart-tree localize-format-function='function(defaultMessage, message, messageArguments){return '...'}'></smart-tree>

Set the localizeFormatFunction property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.localizeFormatFunction = function(defaultMessage, message, messageArguments){return '...'};

Get the localizeFormatFunction property.

 const tree = document.querySelector('smart-tree');
 let localizeFormatFunction = tree.localizeFormatFunction;

messagesobject

Defines or retrieves an object containing the text strings displayed by the widget, enabling customization for different languages and regions. This property is used together with the locale property to provide localization support, allowing you to easily translate or adjust interface text based on the user's language settings.

Default value




"en": {

"propertyUnknownType": "'{{name}}' property is with undefined 'type' member!",

"propertyInvalidValue": "Invalid '{{name}}' property value! Actual value: {{actualValue}}, Expected value: {{value}}!",

"propertyInvalidValueType": "Invalid '{{name}}' property value type! Actual type: {{actualType}}, Expected type: {{type}}!",

"elementNotInDOM": "Element does not exist in DOM! Please, add the element to the DOM, before invoking a method.",

"moduleUndefined": "Module is undefined.",

"missingReference": "{{elementType}}: Missing reference to {{files}}.",

"htmlTemplateNotSuported": "{{elementType}}: Browser doesn't support HTMLTemplate elements.",

"invalidTemplate": "{{elementType}}: '{{property}}' property accepts a string that must match the id of an HTMLTemplate element from the DOM.",

"noId": "smart-tree: Saving and loading the element's state are not available if the element has no id."

}

Example

Set the messages property.

 <smart-tree messages='{"de":{"propertyUnknownType":"Die Eigenschaft '{{name}}' hat ein nicht definiertes 'type'-Member!","propertyInvalidValue":"Ungultiger Eigenschaftswert '{{name}}'! Aktueller Wert: {{actualValue}}, Erwarteter Wert: {{value}}!","propertyInvalidValueType":"Ungultiger Eigenschaftswert '{{name}}'! Aktueller Wert: {{actualType}}, Erwarteter Wert: {{type}}!","elementNotInDOM":"Element existiert nicht in DOM! Bitte fugen Sie das Element zum DOM hinzu, bevor Sie eine Methode aufrufen.","moduleUndefined":"Modul ist nicht definiert.","missingReference":"{{elementType}}: Fehlender Verweis auf {{files}}.","htmlTemplateNotSuported":"{{elementType}}: Browser unterstutzt keine HTMLTemplate-Elemente.","invalidTemplate":"{{elementType}}: '{{property}}' Die Eigenschaft akzeptiert eine Zeichenfolge, die mit der ID eines HTMLTemplate-Elements aus dem DOM ubereinstimmen muss.","noId":"{{elementType}}: Das Speichern und Laden des Elementstatus ist nicht verfugbar, wenn das Element keine ID hat."}}'></smart-tree>

Set the messages property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.messages = {"en":{"propertyUnknownType":"'{{name}}' property is with undefined 'type' member!","propertyInvalidValue":"Invalid '{{name}}' property value! Actual value: {{actualValue}}, Expected value: {{value}}!","propertyInvalidValueType":"Invalid '{{name}}' property value type! Actual type: {{actualType}}, Expected type: {{type}}!","elementNotInDOM":"Element does not exist in DOM! Please, add the element to the DOM, before invoking a method.","moduleUndefined":"Module is undefined.","missingReference":"{{elementType}}: Missing reference to {{files}}.","htmlTemplateNotSuported":"{{elementType}}: Browser doesn't support HTMLTemplate elements.","invalidTemplate":"{{elementType}}: '{{property}}' property accepts a string that must match the id of an HTMLTemplate element from the DOM.","noId":"smart-tree: Saving and loading the element's state are not available if the element has no id."}};

Get the messages property.

 const tree = document.querySelector('smart-tree');
 let messages = tree.messages;

overflow"auto" | "hidden" | "scroll"

Defines the behavior of the scrollbar—or, when 'scrollMode' is set to ''scrollButtons'', the scroll buttons—when the content exceeds the visible area of the element. This setting determines how users can navigate overflow content, such as automatically displaying scrollbars, enabling scroll buttons, or applying custom overflow handling.

Allowed Values

  • "auto" - scrollbar's scroll buttons are shown only when there is not enough space for the content
  • "hidden" - scrollbar's scroll buttons are never shown
  • "scroll" - scrollbar's scroll buttons are always shown

Default value

"auto"

Example

Set the overflow property.

 <smart-tree overflow='hidden'></smart-tree>

Set the overflow property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.overflow = 'scroll';

Get the overflow property.

 const tree = document.querySelector('smart-tree');
 let overflow = tree.overflow;

readonlyboolean

If the element is set to readonly, users will be able to see its value but will not be able to modify, edit, or interact with its content in any way. The element will appear as non-editable, ensuring that its value remains unchanged by user input.

Default value

false

Example

Set the readonly property.

 <smart-tree readonly></smart-tree>

Set the readonly property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.readonly = true;

Get the readonly property.

 const tree = document.querySelector('smart-tree');
 let readonly = tree.readonly;

rightToLeftboolean

Specifies whether right-to-left (RTL) layout support is activated. When enabled, the user interface elements, text direction, and content flow are adjusted to accommodate languages that are read from right to left, such as Arabic or Hebrew.

Default value

false

Example

Set the rightToLeft property.

 <smart-tree right-to-left></smart-tree>

Set the rightToLeft property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.rightToLeft = false;

Get the rightToLeft property.

 const tree = document.querySelector('smart-tree');
 let rightToLeft = tree.rightToLeft;

scrollMode"scrollbar" | "scrollButtons"

Specifies whether to display a traditional scrollbar or to use scroll buttons for navigating content when the element’s content exceeds its visible area. This setting controls the user’s method of scrolling in overflow situations.

Allowed Values

  • "scrollbar" - displays scrollbar
  • "scrollButtons" - displays scroll buttons

Default value

"scrollbar"

Example

Set the scrollMode property.

 <smart-tree scroll-mode='scrollButtons'></smart-tree>

Set the scrollMode property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.scrollMode = 'scrollbar';

Get the scrollMode property.

 const tree = document.querySelector('smart-tree');
 let scrollMode = tree.scrollMode;

selectedIndexesstring[]

A list (array) containing the index paths of the currently selected items. Each element in the array represents the hierarchical position of a selected item within the data structure, allowing precise identification of multiple selections.

Example

Set the selectedIndexes property.

 <smart-tree selected-indexes='[ '0.3', '0.4', '1' ]'></smart-tree>

Set the selectedIndexes property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.selectedIndexes = ['0.1'];

Get the selectedIndexes property.

 const tree = document.querySelector('smart-tree');
 let selectedIndexes = tree.selectedIndexes;

selectionDisplayMode"row" | "label"

Specifies the visual style or method used to highlight selected items, such as changing their background color, border, or font style, to indicate their selection state to the user.

Allowed Values

  • "row" - the entirety of the selected item's width is highlighted
  • "label" - only the selected item's label is highlighted

Default value

"row"

Example

Set the selectionDisplayMode property.

 <smart-tree selection-display-mode='oneOrMany'></smart-tree>

Set the selectionDisplayMode property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.selectionDisplayMode = 'zeroOrOne';

Get the selectionDisplayMode property.

 const tree = document.querySelector('smart-tree');
 let selectionDisplayMode = tree.selectionDisplayMode;

selectionMode"none" | "oneOrManyExtended" | "zeroOrMany" | "oneOrMany" | "zeroAndOne" | "zeroOrOne" | "one" | "checkBox" | "radioButton"

Specifies how selections can be made within the component, such as allowing single selection, multiple selections, or no selection at all.

Allowed Values

  • "none" - no items can be selected
  • "oneOrManyExtended" - one or more items can be selected; selection with Ctrl and Shift is allowed. There is always at least one selected item in the Tree.
  • "zeroOrMany" - any number of items can be selected or none at all
  • "oneOrMany" - one or more items can be selected. There is always at least one selected item
  • "zeroAndOne" - only one item can optionally be selected.
  • "zeroOrOne" - only one item can optionally be selected. Click on the selected item unselects it.
  • "one" - only one item can be selected. There is always at least one selected item in the Tree.
  • "checkBox" - items are selected by checking or unchecking checkboxes
  • "radioButton" - items are selected by checking radio buttons; radio button selection is applied based on groups of sibling items

Default value

"one"

Example

Set the selectionMode property.

 <smart-tree selection-mode='oneOrMany'></smart-tree>

Set the selectionMode property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.selectionMode = 'zeroOrOne';

Get the selectionMode property.

 const tree = document.querySelector('smart-tree');
 let selectionMode = tree.selectionMode;

selectionTarget"all" | "leaf"

Specifies whether selection is enabled for smart-tree-items-groups, allowing users to select one or more groups within the tree component. When set to true, group items in the smartTree can be selected by user interaction.

Allowed Values

  • "all" - All enabled smart-tree-item and smart-tree-items-group sub-elements can be selected.
  • "leaf" - Only enabled smart-tree-item sub-elements can be selected; smart-tree-items-groups cannot be selected.

Default value

"all"

Example

Set the selectionTarget property.

 <smart-tree selection-target='leaf'></smart-tree>

Set the selectionTarget property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.selectionTarget = 'all';

Get the selectionTarget property.

 const tree = document.querySelector('smart-tree');
 let selectionTarget = tree.selectionTarget;

showLinesboolean

Displays or hides connector lines that visually represent the relationships between elements within a group, making it easier to understand how the elements are interconnected.

Default value

false

Example

Set the showLines property.

 <smart-tree show-lines></smart-tree>

Set the showLines property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.showLines = false;

Get the showLines property.

 const tree = document.querySelector('smart-tree');
 let showLines = tree.showLines;

showRootLinesboolean

Controls the visibility of connector lines between tree nodes, starting from the root node. When the 'showLines' property is set to true, lines connecting the hierarchical levels of the tree are displayed; if set to false, these lines are hidden.

Default value

false

Example

Set the showRootLines property.

 <smart-tree show-root-lines></smart-tree>

Set the showRootLines property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.showRootLines = false;

Get the showRootLines property.

 const tree = document.querySelector('smart-tree');
 let showRootLines = tree.showRootLines;

sortfunction | null

Defines a user-provided function to specify custom sorting logic. This function allows you to determine how items are ordered, overriding the default sort behavior. It receives two items as arguments and should return a value indicating their sort order.

Example

Set the sort property.

 <smart-tree sort='customSortingFunction1'></smart-tree>

Set the sort property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.sort = customSortingFunction2;

Get the sort property.

 const tree = document.querySelector('smart-tree');
 let sort = tree.sort;

sortDirection"ascending" | "descending"

Specifies the sort order to be applied, allowing values of either 'ascending' (arranging items from lowest to highest) or 'descending' (arranging items from highest to lowest).

Allowed Values

  • "ascending" - sorts ascending
  • "descending" - sorts descending

Default value

"asc"

Example

Set the sortDirection property.

 <smart-tree sort-direction='desc'></smart-tree>

Set the sortDirection property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.sortDirection = 'asc';

Get the sortDirection property.

 const tree = document.querySelector('smart-tree');
 let sortDirection = tree.sortDirection;

sortedboolean

Controls whether sorting functionality is enabled or disabled for the data set. When enabled, users can sort items based on specified criteria or columns; when disabled, sorting is not available.

Default value

false

Example

Set the sorted property.

 <smart-tree sorted></smart-tree>

Set the sorted property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.sorted = false;

Get the sorted property.

 const tree = document.querySelector('smart-tree');
 let sorted = tree.sorted;

themestring

Sets or retrieves the visual theme applied to the element, allowing you to customize its appearance (such as color scheme, style, or overall look) by selecting from predefined theme options.

Default value

""

Example

Set the theme property.

 <smart-tree theme='dark'></smart-tree>

Set the theme property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.theme = 'red';

Get the theme property.

 const tree = document.querySelector('smart-tree');
 let theme = tree.theme;

toggleElementPosition"near" | "far"

Specifies the position of the toggle element (such as an arrow) within the component, indicating where the toggle control will be displayed relative to the content (e.g., left, right, top, or bottom).

Allowed Values

  • "near" - toggle elements are on the left
  • "far" - toggle elements are on the right

Default value

"near"

Example

Set the toggleElementPosition property.

 <smart-tree toggle-element-position='far'></smart-tree>

Set the toggleElementPosition property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.toggleElementPosition = 'near';

Get the toggleElementPosition property.

 const tree = document.querySelector('smart-tree');
 let toggleElementPosition = tree.toggleElementPosition;

toggleMode"click" | "dblclick" | "arrow"

Controls how groups within smart-tree-items are expanded or collapsed. Specifies the toggle behavior for displaying or hiding group items in the smartTree component.

Allowed Values

  • "click" - toggles groups on click of group or toggle element (arrow)
  • "dblclick" - toggles groups on double-click of group or click of toggle element (arrow)
  • "arrow" - toggles groups only on click of toggle element (arrow)

Default value

"dblclick"

Example

Set the toggleMode property.

 <smart-tree toggle-mode='click'></smart-tree>

Set the toggleMode property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.toggleMode = 'arrow';

Get the toggleMode property.

 const tree = document.querySelector('smart-tree');
 let toggleMode = tree.toggleMode;

unfocusableboolean

Determines whether the element can receive keyboard focus. When set, the element is focusable using keyboard navigation (such as the Tab key) or scripting. This property can also be used to check the current focusable state of the element.

Default value

false

Example

Set the unfocusable property.

 <smart-tree unfocusable></smart-tree>

Set the unfocusable property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.unfocusable = false;

Get the unfocusable property.

 const tree = document.querySelector('smart-tree');
 let unfocusable = tree.unfocusable;

valueMemberstring

Specifies which field in the data source provides the value for each item. This property maps item values in your component or UI element to the corresponding field in your underlying data source, ensuring the correct value is referenced and displayed.

Default value

"value"

Example

Set the valueMember property.

 <smart-tree value-member='info'></smart-tree>

Set the valueMember property by using the HTML Element's instance.

 const tree = document.querySelector('smart-tree');
 tree.valueMember = 'details';

Get the valueMember property.

 const tree = document.querySelector('smart-tree');
 let valueMember = tree.valueMember;

Events

changeCustomEvent

This event is triggered whenever the selected item(s) in the smart-tree component change. It occurs both when a user selects a new item or deselects a previously selected item, allowing developers to execute custom logic in response to changes in the tree's selection state.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onChange

Arguments

evCustomEvent
ev.detailObject
ev.detail.item - The item the user has interacted with to change the selection (only when applicable).
ev.detail.oldSelectedIndexes - The selected indexes before the selection is changed.
ev.detail.selectedIndexes - The selected indexes after the selection is changed.

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of change event.

const tree = document.querySelector('smart-tree');
tree.addEventListener('change', function (event) {
    const detail = event.detail,
        item = detail.item,
        oldSelectedIndexes = detail.oldSelectedIndexes,
        selectedIndexes = detail.selectedIndexes;

	// event handling code goes here.
})

collapseCustomEvent

This event is triggered whenever a smart-tree-items-group component is collapsed by the user. It occurs immediately after the group transitions from an expanded (open) state to a collapsed (closed) state, allowing you to execute custom logic in response to this action.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onCollapse

Arguments

evCustomEvent
ev.detailObject
ev.detail.item - the collapsed smart-tree-items-group
ev.detail.label - the label of the collapsed smart-tree-items-group
ev.detail.path - the path of the collapsed smart-tree-items-group
ev.detail.value - the value of the collapsed smart-tree-items-group
ev.detail.children - the children of the collapsed smart-tree-items-group

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of collapse event.

const tree = document.querySelector('smart-tree');
tree.addEventListener('collapse', function (event) {
    const detail = event.detail,
        item = detail.item,
        label = detail.label,
        path = detail.path,
        value = detail.value,
        children = detail.children;

	// event handling code goes here.
})

collapsingCustomEvent

This event fires immediately before a smart-tree-items-group collapses, providing an opportunity to intercept the action. Within the event handler, you can call event.preventDefault() to cancel the collapsing operation, preventing the group from being closed. This allows developers to implement custom logic—such as confirmation dialogs or validation checks—prior to the group’s collapse.

  • Bubbles Yes
  • Cancelable Yes
  • Interface CustomEvent
  • Event handler property onCollapsing

Arguments

evCustomEvent
ev.detailObject
ev.detail.item - the smart-tree-items-group to be collapsed
ev.detail.label - the label of the smart-tree-items-group to be collapsed
ev.detail.path - the path of the smart-tree-items-group to be collapsed
ev.detail.value - the value of the smart-tree-items-group to be collapsed
ev.detail.children - the children of the smart-tree-items-group to be collapsed

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of collapsing event.

const tree = document.querySelector('smart-tree');
tree.addEventListener('collapsing', function (event) {
    const detail = event.detail,
        item = detail.item,
        label = detail.label,
        path = detail.path,
        value = detail.value,
        children = detail.children;

	// event handling code goes here.
})

dragEndCustomEvent

This event is triggered when a smart-tree-item or smart-tree-items-group element is dropped onto a target location within the DOM during a drag-and-drop operation. You can prevent the drop action from completing—effectively canceling the move—by calling event.preventDefault() within your event handler function. This allows you to implement custom logic to determine whether the drop should be allowed or denied.

  • Bubbles Yes
  • Cancelable Yes
  • Interface CustomEvent
  • Event handler property onDragEnd

Arguments

evCustomEvent
ev.detailObject
ev.detail.container - the tree the dragged item(s) is dropped to
ev.detail.data - an object with additional drag details
ev.detail.item - the item that is dragged; if multiple items are dragged, this is the item that has been clicked when initiating the drag operation
ev.detail.items - an array with all dragged items
ev.detail.originalEvent - the original, browser, event that initiates the drop operation
ev.detail.previousContainer - the tree the dragged item(s) is dragged from
ev.detail.target - the element the dragged items are dropped to

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of dragEnd event.

const tree = document.querySelector('smart-tree');
tree.addEventListener('dragEnd', function (event) {
    const detail = event.detail,
        container = detail.container,
        data = detail.data,
        item = detail.item,
        items = detail.items,
        originalEvent = detail.originalEvent,
        previousContainer = detail.previousContainer,
        target = detail.target;

	// event handling code goes here.
})

draggingCustomEvent

This event is triggered when a smart-tree-item or smart-tree-items-group component starts being dragged by the user. It occurs at the moment the drag operation begins, allowing you to implement custom logic or UI feedback during the drag-and-drop interaction within the smartTree widget.

  • Bubbles Yes
  • Cancelable Yes
  • Interface CustomEvent
  • Event handler property onDragging

Arguments

evCustomEvent
ev.detailObject
ev.detail.data - an object with additional drag details
ev.detail.item - the item that is dragged; if multiple items are dragged, this is the item that has been clicked when initiating the drag operation
ev.detail.items - an array with all dragged items
ev.detail.originalEvent - the original, browser, event that initiates the dragging operation

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of dragging event.

const tree = document.querySelector('smart-tree');
tree.addEventListener('dragging', function (event) {
    const detail = event.detail,
        data = detail.data,
        item = detail.item,
        items = detail.items,
        originalEvent = detail.originalEvent;

	// event handling code goes here.
})

dragStartCustomEvent

This event is fired when a drag operation begins within the smart-tree component. It allows you to intercept the initiation of the drag action. By invoking event.preventDefault() within your event handler, you can cancel the drag operation before it proceeds. This provides an opportunity to implement custom logic, such as conditional validations or user permissions, before allowing or preventing the drag from taking place.

  • Bubbles Yes
  • Cancelable Yes
  • Interface CustomEvent
  • Event handler property onDragStart

Arguments

evCustomEvent
ev.detailObject
ev.detail.container - the tree the dragged item(s) is dragged from
ev.detail.data - an object with additional drag details
ev.detail.item - the item that is dragged; if multiple items are dragged, this is the item that has been clicked when initiating the drag operation
ev.detail.items - an array with all dragged items
ev.detail.originalEvent - the original, browser, event that initiates the drag operation
ev.detail.previousContainer - the tree the dragged item(s) is dragged from

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of dragStart event.

const tree = document.querySelector('smart-tree');
tree.addEventListener('dragStart', function (event) {
    const detail = event.detail,
        container = detail.container,
        data = detail.data,
        item = detail.item,
        items = detail.items,
        originalEvent = detail.originalEvent,
        previousContainer = detail.previousContainer;

	// event handling code goes here.
})

expandCustomEvent

This event is triggered when a `smart-tree-items-group` element within the tree is expanded by the user, either through a mouse click or keyboard interaction. It allows developers to execute custom logic in response to the expansion of a specific group of items within the smartTree component.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onExpand

Arguments

evCustomEvent
ev.detailObject
ev.detail.item - the expanded smart-tree-items-group
ev.detail.label - the label of the expanded smart-tree-items-group
ev.detail.path - the path of the expanded smart-tree-items-group
ev.detail.value - the value of the expanded smart-tree-items-group
ev.detail.children - the children of the expanded smart-tree-items-group

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of expand event.

const tree = document.querySelector('smart-tree');
tree.addEventListener('expand', function (event) {
    const detail = event.detail,
        item = detail.item,
        label = detail.label,
        path = detail.path,
        value = detail.value,
        children = detail.children;

	// event handling code goes here.
})

expandingCustomEvent

This event is fired just before a smart-tree-items-group is expanded. At this stage, the expansion process has not yet occurred, allowing you to perform custom logic or checks. If you want to prevent the group from expanding, call event.preventDefault() within your event handler; this will cancel the default expand action.

  • Bubbles Yes
  • Cancelable Yes
  • Interface CustomEvent
  • Event handler property onExpanding

Arguments

evCustomEvent
ev.detailObject
ev.detail.item - the smart-tree-items-group to be expanded
ev.detail.label - the label of the smart-tree-items-group to be expanded
ev.detail.path - the path of the smart-tree-items-group to be expanded
ev.detail.value - the value of the smart-tree-items-group to be expanded
ev.detail.children - the children of the smart-tree-items-group to be expanded

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of expanding event.

const tree = document.querySelector('smart-tree');
tree.addEventListener('expanding', function (event) {
    const detail = event.detail,
        item = detail.item,
        label = detail.label,
        path = detail.path,
        value = detail.value,
        children = detail.children;

	// event handling code goes here.
})

filterChangeCustomEvent

This event is triggered whenever the selected item in the smart-tree component changes. It occurs after a user selects a different tree node, either through mouse interaction or keyboard navigation, allowing you to respond to selection changes within the tree.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onFilterChange

Arguments

evCustomEvent
ev.detailObject
ev.detail.value - The filter input value.

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of filterChange event.

const tree = document.querySelector('smart-tree');
tree.addEventListener('filterChange', function (event) {
    const detail = event.detail,
        value = detail.value;

	// event handling code goes here.
})

openCustomEvent

This event is triggered each time the dropdown menu becomes visible to the user, such as when the user clicks on the dropdown or focuses on the dropdown field, causing the options list to appear. Use this event to perform actions whenever the dropdown is opened, such as loading options dynamically or tracking user interactions.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onOpen

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of open event.

const tree = document.querySelector('smart-tree');
tree.addEventListener('open', function (event) {
	// event handling code goes here.
})

closeCustomEvent

This event is triggered whenever the dropdown menu is closed, either by user interaction (such as clicking outside the dropdown or selecting an option) or programmatically through the application logic. Use this event to execute any cleanup tasks or update UI elements that depend on the dropdown’s visibility state.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onClose

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of close event.

const tree = document.querySelector('smart-tree');
tree.addEventListener('close', function (event) {
	// event handling code goes here.
})

scrollBottomReachedCustomEvent

This event is triggered when the user scrolls the Tree component all the way to its bottom edge, indicating that the last visible item in the Tree is fully displayed. You can use this event to implement features such as infinite scrolling, lazy loading, or displaying additional content as the user reaches the end of the Tree.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onScrollBottomReached

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of scrollBottomReached event.

const tree = document.querySelector('smart-tree');
tree.addEventListener('scrollBottomReached', function (event) {
	// event handling code goes here.
})

scrollTopReachedCustomEvent

This event is triggered when the user scrolls the Tree component and reaches the very topmost position, indicating that no more content is available above within the scrollable area.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onScrollTopReached

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of scrollTopReached event.

const tree = document.querySelector('smart-tree');
tree.addEventListener('scrollTopReached', function (event) {
	// event handling code goes here.
})

swipeleftCustomEvent

This event is triggered when the user performs a leftward swipe gesture within the Tree component. It detects when the user places their finger or cursor on the Tree and moves it horizontally to the left, allowing you to handle custom interactions or navigation in response to this action.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onSwipeleft

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of swipeleft event.

const tree = document.querySelector('smart-tree');
tree.addEventListener('swipeleft', function (event) {
	// event handling code goes here.
})

swiperightCustomEvent

This event is triggered when the user performs a rightward swipe gesture within the Tree component. It detects when a swipe action starts inside the Tree and moves in the right direction, allowing developers to implement custom behaviors in response to this specific user interaction.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onSwiperight

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of swiperight event.

const tree = document.querySelector('smart-tree');
tree.addEventListener('swiperight', function (event) {
	// event handling code goes here.
})

Methods

addAfter( item: HTMLElement, sibling: string | HTMLElement): void

Inserts a new item immediately after a specified item within the same parent, making it a sibling element in the list or hierarchy.

Arguments

itemHTMLElement

A smart-tree-item/smart-tree-items-group to add to the Tree

siblingstring | HTMLElement

The smart-tree-item/smart-tree-items-group (or its id or numeric path) to add the item after.


Invoke the addAfter method.

const tree = document.querySelector('smart-tree');
tree.addAfter("newItem, 'zed'");

Try a demo showcasing the addAfter method.

addBefore( item: HTMLElement, sibling: string | HTMLElement): void

Inserts a new item directly before a specified existing item within the same parent, making both items siblings in the data structure.

Arguments

itemHTMLElement

A smart-tree-item/smart-tree-items-group to add to the Tree

siblingstring | HTMLElement

The smart-tree-item/smart-tree-items-group (or its id or numeric path) to add the item before.


Invoke the addBefore method.

const tree = document.querySelector('smart-tree');
tree.addBefore("newItem, 'zed'");

Try a demo showcasing the addBefore method.

addTo( item: HTMLElement, parent?: string | HTMLElement): void

Appends a new item to the end of the specified parent item's list of children, making it the last child within the parent structure.

Arguments

itemHTMLElement

A smart-tree-item/smart-tree-items-group to add to the Tree

parent?string | HTMLElement

The smart-tree-items-group (or its id or numeric path) to add the item to.


Invoke the addTo method.

const tree = document.querySelector('smart-tree');
tree.addTo("newItem, 'letters'");

Try a demo showcasing the addTo method.

clearSelection(): void

Removes any current selections, resetting the selection state to none. This action ensures that no items remain highlighted or marked as selected.


Invoke the clearSelection method.

const tree = document.querySelector('smart-tree');
tree.clearSelection("");

collapseAll( animation?: boolean): void

Collapses all elements with the class smart-tree-items-group, ensuring that every expandable group within the tree component is minimized and any nested content is hidden from view. This action provides a streamlined overview of the tree by hiding detailed or child items under each group.

Arguments

animation?boolean

If set to false, disables collapse animation even if animation is enabled for the element.


Invoke the collapseAll method.

const tree = document.querySelector('smart-tree');
tree.collapseAll("true");

collapseItem( item: HTMLElement | string, animation?: boolean): void

Collapses the specified smart-tree-items-group, hiding all of its nested child items from view within the tree component. This action changes the group's state to collapsed, providing a more compact tree display by temporarily concealing its contents.

Arguments

itemHTMLElement | string

smart-tree-items-group (or its id or numeric path).

animation?boolean

If set to false, disables collapse animation even if animation is enabled for the element.


Invoke the collapseItem method.

const tree = document.querySelector('smart-tree');
tree.collapseItem("'0.0'");

closeDropDown(): void

Closes the dropdown menu when the Tree component is operating in dropdown mode, ensuring that the dropdown is dismissed upon selection or when appropriate user interactions occur.


Invoke the closeDropDown method.

const tree = document.querySelector('smart-tree');
tree.closeDropDown("");

openDropDown(): void

Displays the dropdown menu when the Tree component is set to dropdown mode, allowing users to interact with the tree structure within a dropdown interface.


Invoke the openDropDown method.

const tree = document.querySelector('smart-tree');
tree.openDropDown("");

ensureVisible( item: HTMLElement | string): void

Ensures that a specified item is brought into the visible area of the scrollable container by automatically scrolling the container as needed, so the item is fully or partially in view for the user.

Arguments

itemHTMLElement | string

The id or numeric path of an item


Invoke the ensureVisible method.

const tree = document.querySelector('smart-tree');
tree.ensureVisible("'0.0'");

expandAll( animation?: string): void

Expands all elements within the tree component that are assigned the 'smart-tree-items-group' class, making every group and its child items visible in the tree view.

Arguments

animation?string

If set to false, disables expand animation even if animation is enabled for the element.


Invoke the expandAll method.

const tree = document.querySelector('smart-tree');
tree.expandAll("");

expandItem( item: HTMLElement | string, animation?: boolean): void

Expands a specific group within the smartTree component, displaying all child items associated with the selected tree group. This action reveals the contents of a single smart-tree-items-group node, making its nested items visible to the user.

Arguments

itemHTMLElement | string

smart-tree-items-group (or its id or numeric path).

animation?boolean

If set to false, disables expand animation even if animation is enabled for the element.


Invoke the expandItem method.

const tree = document.querySelector('smart-tree');
tree.expandItem("'0.0'");

filter( filterQuery: string): void

Applies a filter to the Tree component, displaying only the nodes that match the specified criteria while hiding all others. This helps users easily find and focus on relevant items within the tree structure.

Arguments

filterQuerystring

Filter query.


Invoke the filter method.

const tree = document.querySelector('smart-tree');
tree.filter("'Sun'");

getItem( id: string): HTMLElement

Retrieves a specific item by using either its unique identifier (ID) or a numeric path value. This function supports both string-based IDs and numeric paths to locate and return the corresponding item from the collection.

Arguments

idstring

The id or numeric path of an item.

ReturnsHTMLElement

Invoke the getItem method.

const tree = document.querySelector('smart-tree');
const result = tree.getItem("'0.0'");

getFilter(): string

Retrieves the currently active filter, including its criteria and settings, that has been applied to the data set.

Returnsstring

Invoke the getFilter method.

const tree = document.querySelector('smart-tree');
const result = tree.getFilter();

getSelectedValues(): string[]

Retrieves the currently selected values from the component. If no value is explicitly set, the method returns the labels of the selected items instead.

Returnsstring[]

Invoke the getSelectedValues method.

const tree = document.querySelector('smart-tree');
const result = tree.getSelectedValues();

getState(): object

Returns the current state of the smartTree component, including information such as which nodes are expanded, collapsed, selected, or checked. This allows you to save or restore the tree’s structure and user interactions.

Returnsobject

Invoke the getState method.

const tree = document.querySelector('smart-tree');
const result = tree.getState("");

Try a demo showcasing the getState method.

insert( item: any, path?: string): void

Inserts a specified item into the array or list at the designated index, shifting subsequent items to the right to accommodate the new element. If the given position is out of range, an error may be thrown or the item may be added at the nearest valid position, depending on implementation.

Arguments

itemany

A smart-tree-item/smart-tree-items-group (or an Object to create an item from) to add to the Tree. If an Object is passed, the available fields are tagName ('smart-tree-item' - default - or 'smart-tree-items-group'), disabled, expanded (only if tagName is 'smart-tree-items-group'), (items) (only if tagName is 'smart-tree-items-group'), (label), separator, shortcut (only if tagName is 'smart-tree-item'), and (value). (items), (label), and (value) have to correspond to the values of itemsMember, displayMember, and valueMember respectively.

path?string

The path to insert the item at.


Invoke the insert method.

const tree = document.querySelector('smart-tree');
tree.insert("{ label: 'New item', shortcut: 'Ctrl+N', tagName: 'smart-tree-item' }, '1.1'");

loadState( state?: any): void

Loads and restores the current state of the Tree, including expanded or collapsed branches, selected nodes, and any custom configurations. This ensures the Tree appears as it was previously saved or last interacted with.

Arguments

state?any

An object returned by one of the methods getState or saveState. If a state is not passed, the method tries to load the state from the browser's localStorage.


Invoke the loadState method.

const tree = document.querySelector('smart-tree');
tree.loadState();

Try a demo showcasing the loadState method.

moveDown( item: HTMLElement | string): void

Moves the selected item one position lower in the order among its sibling elements, placing it directly after the next sibling in the list.

Arguments

itemHTMLElement | string

The smart-tree-item/smart-tree-items-group (or its id or numeric path) to remove.


Invoke the moveDown method.

const tree = document.querySelector('smart-tree');
tree.moveDown("'0.0'");

Try a demo showcasing the moveDown method.

moveUp( item: HTMLElement | string): void

Moves the specified item one position higher in the list of its sibling items, effectively placing it before the previous sibling in the order.

Arguments

itemHTMLElement | string

The smart-tree-item/smart-tree-items-group (or its id or numeric path) to remove.


Invoke the moveUp method.

const tree = document.querySelector('smart-tree');
tree.moveUp("'0.0'");

Try a demo showcasing the moveUp method.

removeItem( item: HTMLElement | string): void

Removes a specified item from the collection or list. This operation locates the target item based on the provided identifier or criteria and deletes it from the data structure, ensuring that the collection is updated accordingly. If the item does not exist, no action is taken.

Arguments

itemHTMLElement | string

The smart-tree-item/smart-tree-items-group (or its id or numeric path) to remove.


Invoke the removeItem method.

const tree = document.querySelector('smart-tree');
tree.removeItem("'0.0'");

Try a demo showcasing the removeItem method.

saveState(): object

Persists the current state of the Tree structure, including all nodes, their expanded or collapsed statuses, and any selection information, allowing the Tree to be accurately restored in future sessions.

Returnsobject

Invoke the saveState method.

const tree = document.querySelector('smart-tree');
const result = tree.saveState("");

Try a demo showcasing the saveState method.

select( item: HTMLElement | string): void

Allows selection of an item either by specifying its numerical index in the list or by providing the item's unique HTMLElement ID. This enables precise targeting of elements for further operations.

Arguments

itemHTMLElement | string

The smart-tree-item/smart-tree-items-group (or its id or numeric path) to remove.


Invoke the select method.

const tree = document.querySelector('smart-tree');
tree.select("'0.0'");

setSelectedValues( items: string | string[]): void

Selects one or multiple items from a list based on their specified values. This allows you to programmatically choose which items are highlighted or marked as selected, using their corresponding value identifiers.

Arguments

itemsstring | string[]

The smart-tree-item/smart-tree-items-group values or labels, if values are not defined.


Invoke the setSelectedValues method.

const tree = document.querySelector('smart-tree');
tree.setSelectedValues("'1'");

unselect( item: HTMLElement | string): void

Deselects a specified item, either by providing its numeric index in the list or by passing the item's HTMLElement ID as a string.

Arguments

itemHTMLElement | string

The smart-tree-item/smart-tree-items-group (or its id or numeric path) to remove.


Invoke the unselect method.

const tree = document.querySelector('smart-tree');
tree.unselect("'0.0'");

unselectValues( items: string | string[]): void

Deselects one or more items based on their specified values, removing them from the current selection set.

Arguments

itemsstring | string[]

The smart-tree-item/smart-tree-items-group values or labels, if values are not defined.


Invoke the unselectValues method.

const tree = document.querySelector('smart-tree');
tree.unselectValues("'1'");

updateItem( item: HTMLElement | string, newItem: any): void

Updates an existing item in the database with new values provided in the request. This operation locates the item by its unique identifier and applies the specified changes to its properties. Returns the updated item upon success.

Arguments

itemHTMLElement | string

smart-tree-item/smart-tree-items-group (or its id or numeric path).

newItemany

An object with updated properties.


Invoke the updateItem method.

const tree = document.querySelector('smart-tree');
tree.updateItem("'0.0', { disabled: false }");

CSS Variables

--smart-tree-default-widthvar()

Default value

"var(--smart-box-width)"

smartTree default width

--smart-tree-default-heightvar()

Default value

"var(--smart-box-height)"

smartTree default height

--smart-tree-scroll-button-sizevar()

Default value

"20px"

smartTree scroll buttons size

--smart-tree-lines-stylevar()

Default value

"dashed"

Default style of the connecting tree lines.

--smart-tree-indentvar()

Default value

"16px"

Defines the indent(hierarchy offset) size of the tree items.

--smart-tree-lines-colorvar()

Default value

"var(--smart-border)"

Defines the color of the connecting lines.

--smart-tree-lines-widthvar()

Default value

"1px"

Defines the width of the connecting lines.

--smart-tree-item-label-heightvar()

Default value

"36px"

Defines the height of tree item labels.

--smart-tree-item-paddingvar()

Default value

"9px 12px"

Defines the padding of the tree items.

--smart-tree-item-vertical-offsetvar()

Default value

"3px"

Defines the vertical offset of the tree items.

--smart-tree-item-horizontal-offsetvar()

Default value

"3px"

Defines the horizontal offset of the tree items.


TreeItem

Defines a tree items.

Selector

smart-tree-item

Properties

DdisabledControls whether the element is enabled (interactive) or disabled (non-interactive). When disabled, the element cannot be interacted with by the user and may appear visually dimmed or inactive.
Llabellabel
Llevellevel
Sselectedselected
Sseparatorseparator
Sshortcutshortcut
Vvaluevalue
RreadonlyPrevents users from interacting with the item, disabling all actions such as clicking, tapping, dragging, or keyboard input. The item will not respond to any user-generated events while this setting is enabled.

Properties

disabledboolean

Controls whether the element is enabled (interactive) or disabled (non-interactive). When disabled, the element cannot be interacted with by the user and may appear visually dimmed or inactive.

Default value

false

Example

Set the disabled property.

 <smart-tree-item disabled></smart-tree-item>

Set the disabled property by using the HTML Element's instance.

 const treeitem = document.querySelector('smart-tree-item');
 treeitem.disabled = false;

Get the disabled property.

 const treeitem = document.querySelector('smart-tree-item');
 let disabled = treeitem.disabled;

labelany

Default value

""

levelnumber

selectedboolean

Default value

false
 <smart-tree-item selected></smart-tree-item>

separatorboolean

Default value

true
 <smart-tree-item separator></smart-tree-item>

shortcutstring

Default value

""

valueany

readonlyboolean

Prevents users from interacting with the item, disabling all actions such as clicking, tapping, dragging, or keyboard input. The item will not respond to any user-generated events while this setting is enabled.

Default value

false

Example

Set the readonly property.

 <smart-tree-item readonly></smart-tree-item>

Set the readonly property by using the HTML Element's instance.

 const treeitem = document.querySelector('smart-tree-item');
 treeitem.readonly = false;

Get the readonly property.

 const treeitem = document.querySelector('smart-tree-item');
 let readonly = treeitem.readonly;

TreeItemsGroup

Defines a group of tree items.

Selector

smart-tree-items-group

Properties

DdisabledControls whether the element is active and can be interacted with by the user. When enabled, the element responds to user input; when disabled, it appears inactive and does not accept interactions.
Eexpandedexpanded
Llabellabel
Llevellevel
Sselectedselected
Sseparatorseparator
Vvaluevalue
RreadonlyPrevents users from interacting with the item by disabling all mouse, keyboard, and touch events, making the item unresponsive to user actions.

Properties

disabledboolean

Controls whether the element is active and can be interacted with by the user. When enabled, the element responds to user input; when disabled, it appears inactive and does not accept interactions.

Default value

false

Example

Set the disabled property.

 <smart-tree-items-group disabled></smart-tree-items-group>

Set the disabled property by using the HTML Element's instance.

 const treeitemsgroup = document.querySelector('smart-tree-items-group');
 treeitemsgroup.disabled = false;

Get the disabled property.

 const treeitemsgroup = document.querySelector('smart-tree-items-group');
 let disabled = treeitemsgroup.disabled;

expandedboolean

Default value

false
 <smart-tree-items-group expanded></smart-tree-items-group>

labelany

Default value

""

levelnumber

selectedboolean

Default value

false
 <smart-tree-items-group selected></smart-tree-items-group>

separatorboolean

Default value

true
 <smart-tree-items-group separator></smart-tree-items-group>

valueany

readonlyboolean

Prevents users from interacting with the item by disabling all mouse, keyboard, and touch events, making the item unresponsive to user actions.

Default value

false

Example

Set the readonly property.

 <smart-tree-items-group readonly></smart-tree-items-group>

Set the readonly property by using the HTML Element's instance.

 const treeitemsgroup = document.querySelector('smart-tree-items-group');
 treeitemsgroup.readonly = false;

Get the readonly property.

 const treeitemsgroup = document.querySelector('smart-tree-items-group');
 let readonly = treeitemsgroup.readonly;