Back to Devexpress

TreeViewItem Class

dashboard-js-devexpress-dot-dashboard-dot-model-e86e831d.md

latest8.0 KB
Original Source

TreeViewItem Class

A Tree View dashboard item that allows end users to filter other dashboard items.

Declaration

ts
export class TreeViewItem extends FilterElementItemBase

Remarks

The Tree View dashboard item displays values hierarchically and allows end users to filter other dashboard items by selecting parent/child values.

The Tree View dashboard item does not support self-reference or parent-child hierarchies. The number of dimensions added to the Tree View item determines the number of levels in the hierarchy. Each level contains unique values from the corresponding level dimension. Values in each level are grouped by values in the previous dimension.

Refer to Filter Elements Overview to learn more about filter elements.

Example

The following example shows how to create the Tree View dashboard item, bind it to data and add to the existing dashboard.

Create data items (dimensions) and use the DataItem.dataMember property to bind them to the existing data source’s columns. Then use the created dimensions in the dashboard item to bind it to data.

After you add the created dashboard item to the Dashboard.items collection, call the Dashboard.rebuildLayout method to rebuild the dashboard layout and display changes.

javascript
// Use the line below for a modular approach:
// import * as Model from 'devexpress-dashboard/model'
// Use the line below for an approach with global namespaces:
// var Model = DevExpress.Dashboard.Model;

// ...
public creatTreeView() { 
    // Create data items for the TreeView.
    var treeViewYear = new Model.Dimension();
    treeViewYear.dataMember("OrderDate");
    treeViewYear.dateTimeGroupInterval('Year');
    var treeViewMonth = new Model.Dimension();
    treeViewMonth.dataMember("OrderDate");
    treeViewMonth.dateTimeGroupInterval('Month');

    // Create TreeView
    var treeViewItem = new Model.TreeViewItem();
    treeViewItem.name('treeView');
    treeViewItem.dataSource(sqlDataSource.componentName());
    treeViewItem.dataMember(sqlDataSource.queries()[0].name());

    treeViewItem.filterDimensions.push(treeViewYear);
    treeViewItem.filterDimensions.push(treeViewMonth);  

    treeViewItem.autoExpand(true);

    control.dashboard().items.push(treeViewItem);
    // ...
    control.dashboard().rebuildLayout();
}

Inherited Members

colorScheme

coloringOptions

componentName

customProperties

dataItems

dataMember

dataSource

disposed

enableSearch

filterDimensions

filterString

formatRules

hiddenDimensions

hiddenMeasures

interactivityOptions

isDisposed

isMasterFilterCrossDataSource

itemType

name

parentContainer

showCaption

visibleDataFilterString

dispose

getInfo

getUniqueNamePrefix

Inheritance

SerializableModel TypedSerializableModel DashboardItem DataDashboardItem FilterElementItemBase TreeViewItem

See Also

Filter Elements Overview (Web)

constructor

Initializes a new instance of the TreeViewItem class.

Declaration

ts
constructor(
    dashboardItemJSON?: any,
    serializer?: DevExpress.Analytics.Utils.ModelSerializer
)

Parameters

NameTypeDescription
dashboardItemJSONany

A JSON object used for dashboard deserialization. Do not pass this parameter directly.

| | serializer | ModelSerializer |

An object used for dashboard deserialization. Do not pass this parameter directly.

|

Properties

autoExpand Property

Specifies whether tree view nodes are expanded by default.

Declaration

ts
autoExpand: ko.Observable<boolean>

Property Value

TypeDescription
Observable<boolean>

true , to expand tree view nodes by default; otherwise, false.

|