Access to Underlying Widgets

The Web Dashboard control uses DevExtreme widgets to visualize data within dashboard items. If necessary, you can access these widgets and customize their settings to add specific capabilities.

The ASPxClientDashboard exposes the following events that allow you to access these widgets and customize their settings.

The ASPxClientDashboardItemWidgetEventArgs.ItemName event parameter returns the component name of the dashboard item whose widget may be customized. Use the ASPxClientDashboardItemWidgetEventArgs.GetWidget method to access the corresponding underlying widget.

The following table lists dashboard items whose underlying widgets may be accessed when handling the ItemWidget... events.

Dashboard Item

Underlying Widget(s)

GridDashboardItem

dxDataGrid

ChartDashboardItem

ScatterChartDashboardItem

dxChart

PieDashboardItem

an array of dxPieChart widgets

GaugeDashboardItem

an array of dxCircularGauge or dxLinearGauge widgets

MapDashboardItem

dxVectorMap

PivotDashboardItem

dxPivotGrid

ComboBoxDashboardItem

dxSelectBox or dxTagBox

ListBoxDashboardItem

dxList

TreeViewDashboardItem

dxTreeList

Note

Note that the dxTreeView widget is used in v17.1 and earlier.

TreemapDashboardItem

dxTreeMap

RangeFilterDashboardItem

dxRangeSelector

CardDashboardItem

CardWidget

TextBoxDashboardItem

n/a See Note

ImageDashboardItem

n/a See Note

CustomDashboardItem

n/a See Note

Note

The content of the TextBoxDashboardItem and ImageDashboardItem are an HTML element wrapped to a jQuery object.

Note

The CustomDashboardItem is a custom widget you can customize directly.

Limitations

Note that changing specific control settings may lead to various issues, thus changing the following settings is not recommended:

  • data binding settings;
  • basic data presentation settings (for instance, a set of grid columns or chart series).
Note

Note that printed or exported documents containing a dashboard/dashboard item do not reflect appearance settings applied using the events meant for accessing underlying controls.

Example

This example demonstrates how to customize client widgets used to visualize data within dashboard items at runtime using ASPxClientDashboard's API.

The following options are changed.

  • Highlighting of the hovered grid row is enabled in the underlying dxDataGrid in the ASPxClientDashboard.ItemWidgetCreated event handler.
  • A standard tooltip that is invoked when an end-user hovers over a chart series point is disabled. You can invoke a tooltip by clicking the required label on the argument axis. The argumentAxisClick event is used for this purpose. Subscription and unsubscription to/from the argumentAxisClick event are performed in the ASPxClientDashboard.ItemWidgetUpdated and ASPxClientDashboard.ItemWidgetUpdating event handlers respectively.
  • A pie legend is shown for the underlying dxPieChart.
function customizeWidgets(args) {
    if (args.ItemName == "gridDashboardItem1") {
        var grid = args.GetWidget();
        grid.option({
            hoverStateEnabled: true
        });
    }
    if (args.ItemName == "chartDashboardItem1") {
        var chart = args.GetWidget();
        chart.option({
            tooltip: {
                enabled: false
            },
            onArgumentAxisClick: function (info) {
                info.component.getAllSeries()[0].getPointsByArg(info.argument)[0].showTooltip()
            }
        });
    }
    if (args.ItemName == "pieDashboardItem1") {
        var pie = args.GetWidget()[0];
        pie.option({
            legend: {
                visible: true,
                border: {
                    visible: true
                }
            }
        });
    }
}

function unsubscribeFromEvents(args) {
    if (args.ItemName == "chartDashboardItem1") {
        var chart = args.GetWidget();
        chart.option({
            onArgumentAxisClick: undefined
        });
    }
}