Tree Blazor API

Tree Properties

NameTypeDefaultDescription
AllowDragboolfalseAllows drag operation in current tree. When enabled, items can be dragged and dropped to a tree with enabled allowDrop.
AllowDropboolfalseAllows drop operation. Dropped items could originate from the current tree or another tree.
AutoHideToggleElementboolfalseAutomatically hides the tree's toggle element (arrow) on mouseleave and shows it on mouseenter.
AutoLoadStateboolfalseEnables or disables auto load state from the browser's localStorage. Information about filtering, sorting, expanded and selected items is loaded.
AutoSaveStateboolfalseEnables or disables auto save state to the browser's localStorage. Information about filtering, sorting, expanded and selected items is saved.
AutoSortbooltrueEnables or disables auto sorting. If modifications are made to a sorted tree, but autoSort is false, the tree will not be re-sorted automatically.
DataSourceIEnumerable<object>N/ADetermines the data source that will be loaded to the Tree.
DisabledboolfalseEnables or disables SmartTree.
DisplayLoadingIndicatorboolfalseShows or hides loading indicator.
DisplayMemberstring"label"Determines the field in the data source that corresponds to an item's label.
DragFeedbackFormatFunctionobjectN/AA callback function for customizing the HTML of the drag feedback. It receives one parameter - an array of the currently dragged items.
DragOffsetint[]new int[]{}Determines the offset of the drag feedback element from the mouse cursor when dragging items. The first member of the array is the horizontal offset and the second one - the vertical offset.
EditableboolfalseEnables or disables item's editting. An edit operation can be initiated by double-clicking a tree item or pressing F2 while an item is selected.
ExpandModeTreeExpandModeTreeExpandMode.MultipleDetermines the expand behavior of TreeItemsGroups in the Tree.
FilterableboolfalseEnables or disables filtering. Shows or hides filter input.
FilterInputPlaceholderstring""Sets custom text for placeholder in the filter input.
FilterMemberstring"label"Determines the TreeItem property that will be used as a filtering criteria. By default the label property is used. It can be set to 'value' if the user wants to filter by the value property or 'textContent' if the user wants to filter by text inside the TreeItem's content or any other property.
FilterModeFilterModeFilterMode.ContainsIgnoreCaseSets filter mode.
HasThreeStatesboolfalseSets or gets whether the tree checkboxes have three states - checked, unchecked and indeterminate. Whorks on selectionMode: 'checkBox'
ItemsMemberstring"items"Determines the field in the data source that corresponds to an item group's subitems collection.
LoadingIndicatorPlaceholderstring"Loading..."Sets custom text for placeholder in the loading indicator if loadingIndicatorPosition is set to 'top' or 'bottom'.
LoadingIndicatorPositionVerticalAlignmentVerticalAlignment.CenterSets the position of the loading indicator.
Localestring"en"Sets or gets the locale. Used in conjunction with the property messages.
MessagesobjectN/ASets or gets an object specifying strings used in the widget that can be localized. Used in conjunction with the property locale.
OverflowOverflowOverflow.AutoSpecifies what should happen with the scrollbar (or scroll buttons in scrollMode: 'scrollButtons') if content overflows the element's box.
ReadonlyboolfalseIf the element is readonly, users cannot interact with it.
RightToLeftboolfalseDetermines whether the right-to-left support is enabled.
ScrollModeTreeScrollModeTreeScrollMode.ScrollbarDetermines whether to use scrollbar or scrollButtons when content overflows an element's box.
SelectedIndexesstring[]new string[]{}An array with indexes (paths) of the selected items.
SelectionDisplayModeTreeSelectionDisplayModeTreeSelectionDisplayMode.RowDetermines the way selected items are highlighted.
SelectionModeTreeSelectionModeTreeSelectionMode.OneDetermines selection mode.
SelectionTargetTreeSelectionTargetTreeSelectionTarget.AllDetermines whether Smart-tree-items-groups can be selected.
ShowLinesboolfalseShows or hides lines, displaying the relation between elements in group.
ShowRootLinesboolfalseShows or hides lines starting from the root node. Enabled when 'showLines' is set to true.
SortobjectN/ASets user-defined function about custom sorting.
SortDirectionTreeSortDirectionTreeSortDirection.AscDetermines sort direction - ascending or descending.
SortedboolfalseEnables or disables sorting.
Themestring""Sets or gets the element's visual theme.
ToggleElementPositionPositionPosition.NearDetermines togle element (arrow) position.
ToggleModeTreeToggleModeTreeToggleMode.DblclickDetermines the way to toggle Smart-tree-items-groups.
UnfocusableboolfalseSets or gets if the element can be focused.
ValueMemberstring"value"Determines the field in the data source that corresponds to an item's value.

Tree Methods

NameTypeArgumentsDescription
AddAftervoidobject item, string siblingAdds an item after another item as a sibling.Args: object item - A smart-tree-item/smart-tree-items-group to add to the Tree,string sibling - The smart-tree-item/smart-tree-items-group (or its id or numeric path) to add the item after.
AddBeforevoidobject item, string siblingAdds an item before another item as a sibling.Args: object item - A smart-tree-item/smart-tree-items-group to add to the Tree,string sibling - The smart-tree-item/smart-tree-items-group (or its id or numeric path) to add the item before.
AddTovoidobject item, string parentAdds an item as the last child of a parent item.Args: object item - A smart-tree-item/smart-tree-items-group to add to the Tree,string parent - The smart-tree-items-group (or its id or numeric path) to add the item to.
AddTovoidobject itemAdds an item as the last child of a parent item.
ClearSelectionvoidN/AClears selection.
CollapseAllvoidbool animationCollapses all smart-tree-items-groups.Args: bool animation - If set to false, disables collapse animation even if animation is enabled for the element.
CollapseAllvoidN/ACollapses all smart-tree-items-groups.
CollapseItemvoidobject item, bool animationCollapses a smart-tree-items-group.Args: object item - smart-tree-items-group (or its id or numeric path).,bool animation - If set to false, disables collapse animation even if animation is enabled for the element.
CollapseItemvoidobject itemCollapses a smart-tree-items-group.
EnsureVisiblevoidobject itemMakes sure an item is visible by scrolling to it.Args: object item - The id or numeric path of an item
ExpandAllvoidstring animationExpands all smart-tree-items-groups.Args: string animation - If set to false, disables expand animation even if animation is enabled for the element.
ExpandAllvoidN/AExpands all smart-tree-items-groups.
ExpandItemvoidobject item, bool animationExpands single smart-tree-items-group.Args: object item - smart-tree-items-group (or its id or numeric path).,bool animation - If set to false, disables expand animation even if animation is enabled for the element.
ExpandItemvoidobject itemExpands single smart-tree-items-group.
Filtervoidstring filterQueryApplies filter to the Tree.Args: string filterQuery - Filter query.
GetDataSourceAsync()Task<IEnumerable<object>>'N/A'Gets the &quot;DataSource&quot; property as Task&lt;IEnumerable&lt;object&gt;&gt;.
GetItemobjectstring idGets an item by its id or numeric path.Args: string id - The id or numeric path of an item.
GetSelectedIndexesAsync()Task<string[]>'N/A'Gets the &quot;SelectedIndexes&quot; property as Task&lt;string[]&gt;.
GetStateobjectN/AReturns SmartTree's state
Insertvoidobject item, string pathInserts an item at the given position.Args: object item - 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.,string path - The path to insert the item at.
Insertvoidobject itemInserts an item at the given position.
LoadStatevoidobject stateLoads the Tree's state.Args: object state - 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.
LoadStatevoidN/ALoads the Tree's state.
MoveDownvoidobject itemMoves an item down relative to its siblings.Args: object item - The smart-tree-item/smart-tree-items-group (or its id or numeric path) to remove.
MoveUpvoidobject itemMoves an item up relative to its siblings.Args: object item - The smart-tree-item/smart-tree-items-group (or its id or numeric path) to remove.
Refreshvoid'N/A'Refreshes the Blazor Component. Performs a layout of the HTML Elements and recalculates the measurements.
RemoveItemvoidobject itemRemoves an item.Args: object item - The smart-tree-item/smart-tree-items-group (or its id or numeric path) to remove.
Rendervoid'N/A'Re-renders the Blazor Component. This method will make a full re-render.
SaveStateobjectN/ASaves the Tree's state.
Selectvoidobject itemSelects an item.Args: object item - The smart-tree-item/smart-tree-items-group (or its id or numeric path) to remove.
StateHasChangedvoid'N/A'Refreshes the state and Re-renders the Blazor Component, if necessary.
Unselectvoidobject itemUnselects an item.Args: object item - The smart-tree-item/smart-tree-items-group (or its id or numeric path) to remove.
UpdateItemvoidobject item, object newItemUpdates an item.Args: object item - smart-tree-item/smart-tree-items-group (or its id or numeric path).,object newItem - An object with updated properties.

Tree Events

NameTypeDescriptionEvent Detail
OnChangeEventCallback<Event>This event is triggered when selection in jqx-tree is changed.dynamic item- The item the user has interacted with to change the selection (only when applicable)., IEnumerable<string> oldSelectedIndexes- The selected indexes before the selection is changed., IEnumerable<string> selectedIndexes- The selected indexes after the selection is changed.
Changedevent TreeChangedEventHandlerThis event is triggered when selection in jqx-tree is changed.TreeChangedEventArgs
OnCollapseEventCallback<Event>This event is triggered when a jqx-tree-items-group is collapsed.dynamic item- the collapsed jqx-tree-items-group, string label- the label of the collapsed jqx-tree-items-group, dynamic path- the path of the collapsed jqx-tree-items-group, dynamic value- the value of the collapsed jqx-tree-items-group, dynamic children- the children of the collapsed jqx-tree-items-group
Collapsedevent TreeCollapsedEventHandlerThis event is triggered when a jqx-tree-items-group is collapsed.TreeCollapsedEventArgs
OnCollapsingEventCallback<Event>This event is triggered when a jqx-tree-items-group is about to be collapsed. The collapsing operation can be canceled by calling event.preventDefault() in the event handler function.dynamic item- the jqx-tree-items-group to be collapsed, string label- the label of the jqx-tree-items-group to be collapsed, dynamic path- the path of the jqx-tree-items-group to be collapsed, dynamic value- the value of the jqx-tree-items-group to be collapsed, dynamic children- the children of the jqx-tree-items-group to be collapsed
Collapsingevent TreeCollapsingEventHandlerThis event is triggered when a jqx-tree-items-group is about to be collapsed. The collapsing operation can be canceled by calling event.preventDefault() in the event handler function.TreeCollapsingEventArgs
OnDragEndEventCallback<Event>This event is triggered when a jqx-tree-item/jqx-tree-items-group is dropped somewhere in the DOM. The dragging operation can be canceled by calling event.preventDefault() in the event handler function.dynamic container- the tree the dragged item(s) is dropped to, dynamic data- an object with additional drag details, dynamic item- the item that is dragged; if multiple items are dragged, this is the item that has been clicked when initiating the drag operation, dynamic items- an array with all dragged items, dynamic originalEvent- the original, browser, event that initiates the drop operation, dynamic previousContainer- the tree the dragged item(s) is dragged from, dynamic target- the element the dragged items are dropped to
DragEndedevent TreeDragEndedEventHandlerThis event is triggered when a jqx-tree-item/jqx-tree-items-group is dropped somewhere in the DOM. The dragging operation can be canceled by calling event.preventDefault() in the event handler function.TreeDragEndedEventArgs
OnDraggingEventCallback<Event>This event is triggered when a jqx-tree-item/jqx-tree-items-group is being dragged.dynamic data- an object with additional drag details, dynamic item- the item that is dragged; if multiple items are dragged, this is the item that has been clicked when initiating the drag operation, dynamic items- an array with all dragged items, dynamic originalEvent- the original, browser, event that initiates the dragging operation
Draggingevent TreeDraggingEventHandlerThis event is triggered when a jqx-tree-item/jqx-tree-items-group is being dragged.TreeDraggingEventArgs
OnDragStartEventCallback<Event>This event is triggered when a dragging operation is started in jqx-tree. The dragging operation can be canceled by calling event.preventDefault() in the event handler function.dynamic container- the tree the dragged item(s) is dragged from, dynamic data- an object with additional drag details, dynamic item- the item that is dragged; if multiple items are dragged, this is the item that has been clicked when initiating the drag operation, dynamic items- an array with all dragged items, dynamic originalEvent- the original, browser, event that initiates the drag operation, dynamic previousContainer- the tree the dragged item(s) is dragged from
DragStartedevent TreeDragStartedEventHandlerThis event is triggered when a dragging operation is started in jqx-tree. The dragging operation can be canceled by calling event.preventDefault() in the event handler function.TreeDragStartedEventArgs
OnExpandEventCallback<Event>This event is triggered when a jqx-tree-items-group is expanded.dynamic item- the expanded jqx-tree-items-group, string label- the label of the expanded jqx-tree-items-group, dynamic path- the path of the expanded jqx-tree-items-group, dynamic value- the value of the expanded jqx-tree-items-group, dynamic children- the children of the expanded jqx-tree-items-group
Expandedevent TreeExpandedEventHandlerThis event is triggered when a jqx-tree-items-group is expanded.TreeExpandedEventArgs
OnExpandingEventCallback<Event>This event is triggered when a jqx-tree-items-group is about to be expanded. The expanding operation can be canceled by calling event.preventDefault() in the event handler function.dynamic item- the jqx-tree-items-group to be expanded, string label- the label of the jqx-tree-items-group to be expanded, dynamic path- the path of the jqx-tree-items-group to be expanded, dynamic value- the value of the jqx-tree-items-group to be expanded, dynamic children- the children of the jqx-tree-items-group to be expanded
Expandingevent TreeExpandingEventHandlerThis event is triggered when a jqx-tree-items-group is about to be expanded. The expanding operation can be canceled by calling event.preventDefault() in the event handler function.TreeExpandingEventArgs
OnScrollBottomReachedEventCallback<Event>This event is triggered when the Tree has been scrolled to the bottom.N/A
ScrollBottomReachedevent TreeScrollBottomReachedEventHandlerThis event is triggered when the Tree has been scrolled to the bottom.TreeScrollBottomReachedEventArgs
OnScrollTopReachedEventCallback<Event>This event is triggered when the Tree has been scrolled to the top.N/A
ScrollTopReachedevent TreeScrollTopReachedEventHandlerThis event is triggered when the Tree has been scrolled to the top.TreeScrollTopReachedEventArgs
OnSwipeleftEventCallback<Event>This event is triggered when the user swipes to the left inside the Tree.N/A
SwipedLeftevent TreeSwipedLeftEventHandlerThis event is triggered when the user swipes to the left inside the Tree.TreeSwipedLeftEventArgs
OnSwiperightEventCallback<Event>This event is triggered when the user swipes to the right inside the Tree.N/A
SwipeRightevent TreeSwipeRightEventHandlerThis event is triggered when the user swipes to the right inside the Tree.TreeSwipeRightEventArgs

Enums

TreeExpandMode

TreeExpandMode.Multiple
TreeExpandMode.Single

FilterMode

FilterMode.Contains
FilterMode.ContainsIgnoreCase
FilterMode.DoesNotContain
FilterMode.DoesNotContainIgnoreCase
FilterMode.Equals
FilterMode.EqualsIgnoreCase
FilterMode.StartsWith
FilterMode.StartsWithIgnoreCase
FilterMode.EndsWith
FilterMode.EndsWithIgnoreCase

VerticalAlignment

VerticalAlignment.Bottom
VerticalAlignment.Center
VerticalAlignment.Top

Overflow

Overflow.Auto
Overflow.Hidden
Overflow.Scroll

TreeScrollMode

TreeScrollMode.Scrollbar
TreeScrollMode.ScrollButtons

TreeSelectionDisplayMode

TreeSelectionDisplayMode.Row
TreeSelectionDisplayMode.Label

TreeSelectionMode

TreeSelectionMode.None
TreeSelectionMode.OneOrManyExtended
TreeSelectionMode.ZeroOrMany
TreeSelectionMode.OneOrMany
TreeSelectionMode.ZeroAndOne
TreeSelectionMode.ZeroOrOne
TreeSelectionMode.One
TreeSelectionMode.CheckBox
TreeSelectionMode.RadioButton

TreeSelectionTarget

TreeSelectionTarget.All
TreeSelectionTarget.Leaf

TreeSortDirection

TreeSortDirection.Ascending
TreeSortDirection.Descending

Position

Position.Near
Position.Far

TreeToggleMode

TreeToggleMode.Click
TreeToggleMode.Dblclick
TreeToggleMode.Arrow