Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BSTreeViewNode

This class describes a node of an BSTreeView

Hierarchy

  • BSTreeViewNode

Index

Constructors

constructor

Properties

Private _domBadges

_domBadges: HTMLElement[] = []

The elements of badges on this treeview

internal

Private _domCheckbox

_domCheckbox: HTMLElement = null

The element representing the checkbox on this element

internal

Private _domElement

_domElement: HTMLElement = null

The dom element representing this node

internal

Private _domIcon

_domIcon: HTMLElement = null

The element representing the (user definable) icon on this element

internal

Private _domIconExpand

_domIconExpand: HTMLElement = null

The expand icon displayed on a given node, typically to the left of the text. (Optional)

internal

Private _domImage

_domImage: HTMLElement = null

The element representing the image description of this element

internal

Private _domIndents

_domIndents: HTMLElement[] = []

The elements used to build the node level indentation

internal

Private _domText

_domText: HTMLElement = null

The span in which the text of this node is contained

internal

Private _index

_index: number

The index of this entry in the parent's children array.

internal

Private _level

_level: number = 1

The hierarchy level this node is at.

internal

Private _nodeId

_nodeId: string

The internal node ID. This is used to identify the node in the treeview via its path

internal

Private _options

The options of the treeview this node belongs to

internal

Private _parentNode

_parentNode: BSTreeViewNode | null = null

The parent of this node if it is existing

internal

Private _searchResult

_searchResult: boolean

Whether this node is marked as a search result or not

internal

Private _treeView

_treeView: BSTreeView

The treeview this node belongs to

internal

backColor

backColor: string

The background color used on a given node, overrides global color option. (Optional)

checkable

checkable: boolean = true

Whether a node is checkable in the tree, used in conjunction with showCheckbox. Default true

class

class: string

List of custom CSS classes to append, separated by space.

color

color: string

The foreground color used on a given node, overrides global color option. (Optional)

dataAttr

dataAttr: Record<string, string>

List of per-node HTML data- attributes to append.

hideCheckbox

hideCheckbox: boolean

Used to hide the checkbox of the given node when showCheckbox is set to true

href

href: string

icon

icon: string

The icon displayed on a given node, typically to the left of the text. (Optional)

iconBackground

iconBackground: string

The color used under a given node's background icon. (Optional)

iconColor

iconColor: string

The color used on a given node's icon. (Optional)

id

id: string

Custom HTML id attribute

image

image: string

The URL to an image displayed on a given node, overrides the icon. (Optional)

lazyLoad

lazyLoad: boolean = false

Adds an expand icon to the node even if it has no children, it calls the lazyLoad() function (described below) upon the first expand. Default: false (Optional)

nodes

selectable

selectable: boolean = true

Whether a node is selectable in the tree. False indicates the node should act as an expansion heading and will not fire selection events. Default true

selectedIcon

selectedIcon: string

The icon displayed on a given node when selected, typically to the left of the text. (Optional)

state

state: BSTreeViewNodeState = new BSTreeViewNodeState()

The current state of this node. See @BSTreeViewNodeState for more details

tags

tags: string[] | Record<string, string>[]

Used in conjunction with global showTags option to add additional information to the right of each node; using Bootstrap Badges, A tag can be an object with properties 'text' for tag value and 'class' for class names(s) of this tag

tagsClass

tagsClass: string = null

Sets the class of node tags. Default null

text

text: string

The text value displayed for a given tree node, typically to the right of the nodes icon. (Mandatory)

tooltip

tooltip: string

The tooltip value displayed for a given tree node on mouse hover. (Optional)

Accessors

parentId

  • get parentId(): string | null
  • Returns the nodeID of the parent node Returns null, if this element has no parent

    Returns string | null

Methods

Private _addCheckbox

  • _addCheckbox(): void
  • This function creates the _domCheckbox element and add it to the dom if a checkbox should be shown

    internal

    Returns void

Private _addIcon

  • _addIcon(): void
  • This function creates the _domIcon element and add it to the dom if an icon should be shown

    internal

    Returns void

Private _addImage

  • _addImage(): void
  • This function creates the _domImage element and add it to the dom if an image should be shown

    internal

    Returns void

Private _lazyLoad

  • _lazyLoad(): void
  • Perform the lazy load on this node, using the lazyLoad function if present

    internal

    Returns void

Private _removeNodeEl

  • _removeNodeEl(): void

Private _renderNode

  • _renderNode(): HTMLElement
  • Creates the underlying HTMLElement for this node and updates its properties.

    internal

    Returns HTMLElement

_setAriaOwnsValue

  • _setAriaOwnsValue(): void
  • Recursively set the aria-owns attribute of this element to make the hierarchy accessible This is only possible after the tree is rendered

    Returns void

Private _setSearchResult

Private _setVisible

  • Changes the visibility state of this node. Mostly useful for internal use

    internal

    Parameters

    Returns void

Private _triggerEvent

  • Create the given event on the nodes element. The event bubbles the DOM upwards. Details about the node and the used treeView are passed via event.detail

    internal

    Parameters

    • eventType: string

      The name of the event to generate (see EVENT_* constants in BSTreeViewEventNames)

    • Default value options: Partial<BSTreeViewMethodOptions> = null

    Returns void

Private _updateChildrenHierarchy

  • _updateChildrenHierarchy(): void
  • Update the children nodes for hierarchy, by setting the right values for parent, level and index. All children nodes are registered then at the treeview. Beware that this node itself is not registered! Also, hierarchically dependent node properties are set here. This function is called recursively.

    internal

    Returns void

getChildren

getChildrenCount

  • getChildrenCount(): number

getLevel

  • getLevel(): number
  • Returns the level of this node in the treeview Please note that the value is only correct after the nodes have been rendered

    Returns number

getParentNode

getTreeView

hasChildren

  • hasChildren(): boolean

isChildNode

  • isChildNode(): boolean
  • Returns true, if this node is a child node, meaning it has a parent node. False otherwise.

    Returns boolean

isEndNode

  • isEndNode(): boolean
  • Returns true, if this node is an end node, meaning it has no child nodes. False otherwise.

    Returns boolean

isRootNode

  • isRootNode(): boolean
  • Returns true, if this node is a root node (meaning it has no parent). False otherwise.

    Returns boolean

setChecked

setDisabled

setExpanded

  • Sets the expanded state of this node.

    Parameters

    • state: boolean

      True, if the node should be expanded, false to collapse it.

    • Default value options: Partial<BSTreeViewMethodOptions> = new BSTreeViewMethodOptions()

    Returns this

setSelected

toggleChecked

toggleDisabled

toggleExpanded

  • Toggle the expanded state of this node (if it was expanded, it will be collapsed, and vice versa)

    Parameters

    Returns this

toggleSelected

Static fromData

  • Create a new node object from partial data object, containing the properties which should be set on the node. This function creates the children nodes objects from the data object recursively.

    Parameters

    • data: Partial<BSTreeViewNode>

      An object with the properties which should be set on the node.

    • treeView: BSTreeView

      The treeview this node belongs to

    Returns BSTreeViewNode

Generated using TypeDoc