The requested page is not available for the requested platform. You are viewing the content for Default platform.

Providing Data

This topic describes how to bind filter elements to data using the Web Dashboard control.

The Web Dashboard allows you to bind various dashboard items to data in a consistent manner, the only difference being the data sections that these dashboard items comprise.

Binding Overview

All filter elements provide the Dimensions data section, which accepts dimensions used to provide filter values.

To bind the filter elements to data, click a placeholder contained in one of the available data sections and select the required data source field in the Binding section of the invoked data item menu.

To learn about the specifics of binding various filter elements to data, see the table below.

Dashboard Item API Data Sections Description
ComboBoxItem FilterElementItemBase.filterDimensions wdd-filter-elements-combobox-bindings The Combo Box filter element can contain several dimensions at the Dimensions data section. In this case , the drop-down list will contain combinations of dimension values.
ListBoxItem FilterElementItemBase.filterDimensions wdd-filter-elements-listbox-bindings The List Box filter element can contain several dimensions at the Dimensions data section. In this case, the list will contain combinations of dimension values.
TreeViewItem FilterElementItemBase.filterDimensions wdd-filter-elements-treeview-bindings The Tree View filter element can contain several dimensions at the Dimensions data section. In this case, dimension values are displayed hierarchically. This can be the set of dimensions with different group intervals (e.g., Year/Quarter/Month) or the set of related dimensions (e.g., geographical data such as continents/countries/cities).

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.

// 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();
}