ASP.NET MVC Controls | ComponentOne
In This Topic
    TreeNode Class
    In This Topic
    File
    wijmo.nav.js
    Module
    wijmo.nav

    Class that represents a node in a TreeView.

    Constructor

    Properties

    Methods

    Constructor

    constructor

    constructor(treeView: TreeView, nodeElement: HTMLElement): TreeNode
    

    Initializes a new instance of a TreeNode.

    Parameters
    Returns
    TreeNode

    Properties

    checkBox

    Gets the HTMLInputElement that represents the checkbox associated with this node.

    Type
    HTMLInputElement

    dataItem

    Gets the data item that this node represents.

    Type
    any

    element

    Gets the HTML element that represents this node on the TreeView.

    Type
    HTMLElement

    hasChildren

    Gets a value that indicates whether this node has child nodes.

    Type
    boolean

    hasPendingChildren

    Gets a value that indicates whether this node has pending child nodes that will be lazy-loaded when the node is expanded.

    Type
    boolean

    index

    Gets this node's index within the parent's node collection.

    Type
    number

    isChecked

    Gets or sets a value that determines whether this node is checked.

    When the value of this property changes, child and ancestor nodes are automatically updated, and the parent TreeView's checkedItemsChanged event is raised.

    Type
    boolean

    isCollapsed

    Gets or sets a value that determines whether this node is expanded or collapsed.

    Type
    boolean

    isDisabled

    Gets or sets a value that determines whether this node is disabled.

    Disabled nodes cannot get mouse or keyboard events.

    If the collapseWhenDisabled proprety is set to true, disabling a node also collapses it.

    Type
    boolean

    itemsSource

    Gets the array that contains the items for this TreeNode.

    This property is read-only. It returns an array that is a member of the parent TreeView's itemsSource array.

    Type
    any[]

    level

    Gets this node's level.

    Top-level nodes have level zero.

    Type
    number

    nodes

    Gets an array containing this node's child nodes.

    This property returns null if the node has no children.

    Type
    TreeNode[]

    parentNode

    Gets this node's parent node.

    This property returns null for top-level nodes.

    Type
    TreeNode

    treeView

    Gets a reference to the TreeView that contains this node.

    Type
    TreeView

    Methods

    addChildNode

    addChildNode(index: number, dataItem: any): TreeNode
    

    Adds a child node at a specific position.

    Parameters
    • index: number

      Index of the new child node.

    • dataItem: any

      Data item used to create the new node.

    Returns
    TreeNode

    ensureVisible

    ensureVisible(): void
    

    Ensures that a node is visible by expanding any collapsed ancestors and scrolling the element into view.

    Returns
    void

    equals

    equals(node: TreeNode): boolean
    

    Checks whether this node refers to the same element as another node.

    Parameters
    • node: TreeNode

      @TreeNode to compare with this one.

    Returns
    boolean

    move

    move(refNode: any, position: DropPosition): boolean
    

    Moves this TreeNode to a new position on the TreeView.

    Parameters
    • refNode: any

      Reference TreeNode that defines the location where the node will be moved.

    • position: DropPosition

      Whether to move the node before, after, or into the reference node.

    Returns
    boolean
    Optional

    Whether to return only visible nodes (whose ancestors are not collapsed).

    Whether to return only enabled nodes (whose ancestors are not disabled).

    Returns
    TreeNode

    nextSibling

    nextSibling(): TreeNode
    

    Gets a reference to the next sibling node in the view.

    Returns
    TreeNode
    Optional

    Whether to return only visible nodes (whose ancestors are not collapsed).

    Whether to return only enabled nodes (whose ancestors are not disabled).

    Returns
    TreeNode

    previousSibling

    previousSibling(): TreeNode
    

    Gets a reference to the previous sibling node in the view.

    Returns
    TreeNode

    refresh

    refresh(dataItem?: any): void
    

    Refreshes a node to reflect data changes.

    Parameters
    • dataItem: any Optional

      New node data. If not provided, the node is refreshed based on its original data item (which presumably has been updated).

    Returns
    void

    remove

    remove(): void
    

    Removes this TreeNode from a TreeView.

    Returns
    void

    select

    select(): void
    

    Selects this node.

    Returns
    void

    setChecked

    setChecked(checked: boolean, updateParent?: boolean): void
    

    Sets the checked state of this node and its children.

    Parameters
    • checked: boolean

      Whether to check or uncheck the node and its children.

    • updateParent: boolean Optional

      Whether to update the checked state of this node's ancestor nodes.

    Returns
    void

    setCollapsed

    setCollapsed(collapsed: boolean, animate?: boolean, collapseSiblings?: boolean): void
    

    Sets the collapsed state of the node.

    Parameters
    • collapsed: boolean

      Whether to collapse or expand the node.

    • animate: boolean Optional

      Whether to use animation when applying the new state.

    • collapseSiblings: boolean Optional

      Whether to collapse sibling nodes when expanding this node.

    Returns
    void