v7.3.0
SupportExamplesFree Trial

Tree
Feature

Feature that makes the grid work more like a tree. Included by default in TreeGrid. Requires exactly one TreeColumn among grids columns. That column will have its renderer replaced with a tree renderer that adds padding and icon to give the appearance of a tree. The original renderer is preserved and also called.

targetElement.innerHTML = '<p>Tree feature requires a store with <code>{ tree: true }</code> and a TreeColumn among columns</p>'; const grid = new Grid({ appendTo : targetElement, height : 500, features : { tree : true }, store : { tree : true, data : [ { id : 1, name : 'ABBA', iconCls : 'fa fa-users', children : [ { id : 11, name : 'Anni-Frid', iconCls : 'fa fa-user' }, { id : 12, name : 'Bjorn', iconCls : 'fa fa-user' }, { id : 13, name : 'Benny', iconCls : 'fa fa-user' }, { id : 14, name : 'Agnetha', iconCls : 'fa fa-user' } ] }, { id : 2, name : 'Roxette', iconCls : 'fa fa-users', children : [ { id : 21, name : 'Per', iconCls : 'fa fa-user' }, { id : 22, name : 'Marie', iconCls : 'fa fa-user' } ] } ] }, columns : [ { type : 'tree', field : 'name', text : 'Name', flex : 1 } ] });

This feature is disabled by default. When enabled, the feature cannot be disabled during runtime.

Keyboard shortcuts

This feature has the following default keyboard shortcuts:

Keys Action Action description
Space toggleCollapseByKey When focus on a parent node, this expands or collapses its children
ArrowRight expandIfSingleColumn Expands a focused parent node if grid consist of one column only
Shift+ArrowRight expandByKey Expands a focused parent node
ArrowLeft collapseIfSingleColumn Collapses a focused parent node if grid consist of one column only
Shift+ArrowLeft collapseByKey Collapses a focused parent node
Please note that Ctrl is the equivalent to Command and Alt is the equivalent to Option for Mac users

For more information on how to customize keyboard shortcuts, please see our guide

See also

No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class
  • Expand parent nodes when clicking on their cell

    Has a corresponding runtime expandOnCellClick property.

  • See Keyboard shortcuts for details

  • Show or hide tree lines

    Has a corresponding runtime treeLines property.

  • Internal listeners, that cannot be removed by the user.

  • The widget which this plugin is to attach to.

    Has a corresponding runtime client property.

  • Set to false to disable localization of this object.

Properties

Properties are getters/setters or publicly accessible variables on this class
  • isEvents : Booleantrue
    READONLY
    static
    ADVANCED
    Events
    Identifies an object as an instance of Events class, or subclass thereof.
  • isLocalizable : Booleantrue
    READONLY
    static
    ADVANCED
    Localizable
    Identifies an object as an instance of Localizable class, or subclass thereof.
  • isTree : Booleantrue
    READONLY
    static
    ADVANCED
    Identifies an object as an instance of Tree class, or subclass thereof.
  • properties : Object
    internal
    static
    InstancePlugin

    A class property getter for the default values of internal properties for this class.

  • Expand parent nodes when clicking on their cell

    Has a corresponding expandOnCellClick config.

  • Show or hide tree lines

    Has a corresponding treeLines config.

  • emptyArray : Array
    internal
    READONLY
    InstancePlugin

    An empty array that can be used as a default value.

  • emptyObject : Object
    internal
    READONLY
    InstancePlugin

    An empty object that can be used as a default value.

  • isInstancePlugin : Booleantrue
    READONLY
    ADVANCED
    InstancePlugin
    Identifies an object as an instance of InstancePlugin class, or subclass thereof.
  • isTree : Booleantrue
    READONLY
    ADVANCED
    Identifies an object as an instance of Tree class, or subclass thereof.
  • config : Object
    READONLY
    ADVANCED
    InstancePlugin

    Returns a copy of the full configuration which was used to configure this object.

  • This property is set to true before the constructor returns.

  • isDestroying : Boolean
    READONLY
    ADVANCED
    InstancePlugin

    This property is set to true on entry to the destroy method. It remains on the objects after returning from destroy(). If isDestroyed is true, this property will also be true, so there is no need to test for both (for example, comp.isDestroying || comp.isDestroyed).

  • client : Widget
    READONLY
    ADVANCED
    InstancePlugin

    The Widget which was passed into the constructor, which is the Widget we are providing extra services for.

    Has a corresponding client config.

  • Get the global LocaleHelper

  • Get the global LocaleManager

Functions

Functions are methods available for calling on the class
  • onClassMixedIn( )
    internal
    static
    InstancePlugin

    This optional class method is called when a class is mixed in using the mixin() method.

  • initClass( )
    static
    ADVANCED
    InstancePlugin

    Registers this class type with its Factory

  • onElementClick( )
    private

    Called when user clicks somewhere in the grid. Expand/collapse node on icon click.

  • Called on key down in grid. Expand/collapse node on Space

  • Internal function used to hook destroy() calls when using thisObj

  • Internal function used restore hooked destroy() calls when using thisObj

  • doDestroy( )
    internal
    Events

    Auto detaches listeners registered from start, if set as detachable

  • once( )
    private
    Events

    Internal function used to run a callback function after an event is triggered

  • Removes all listeners registered to this object by the application.

  • This will merge a feature's (subclass of InstancePlugin) keyMap with it's client's keyMap.

  • collapseAll( )
    ASYNC
    ON-OWNER

    Collapse all nodes. This function is exposed on Grid and can thus be called as grid.collapseAll()

  • expandAll( )
    ASYNC
    ON-OWNER

    Expand all nodes. This function is exposed on Grid and can thus be called as grid.expandAll()

Events

Events are triggered for certain actions in this class and can be listened for to react to those actions in your code

Event handlers

Event handlers are callbacks called as a result of certain actions in this class
id: tree

Source path

Grid/feature/Tree.js

Demo

examples/tree

Contents