Skip to main content
A newer version of this page is available. .
All docs
V21.1

Manage Extensions in Angular

  • 3 minutes to read

You can access extensions to customize the Web Dashboard control. The extension is an independent JavaScript module/class that adds specific functionality to the control. For example, the DashboardExportExtension enables users to export dashboard data, the DashboardParameterDialogExtension manages dashboard parameters, and the ToolboxExtension allows you to customize the Toolbox. Each object implements the IExtension interface.

View the DevExpress.Dashboard.Designer module to find extensions used in the Web Dashboard when it operates as a designer. The DevExpress.Dashboard contains extensions used both in Designer and Viewer modes. You can use the DashboardControl.extensions property to get an array of registered extensions you can customize.

Specify Extension Options

You can use the extensions property to access registered extension settings. The code below changes the DataInspectorExtension options to enable the Data Inspector:

<div class="content">
  <dx-dashboard-control 
    endpoint='http://localhost:5000/api/dashboard'>
    <dxo-extensions>
        <dxo-data-inspector
          allowInspectAggregatedData="true"
          allowInspectRawData="true"
        >
        </dxo-data-inspector>
    </dxo-extensions>
  </dx-dashboard-control>
</div>

Remove an Extension

You can unregister the extension to remove the specific functionality from the Web Dashboard. For example, you can completely remove the export functionality if you unregister the DashboardExportExtension.

To remove the registered extension, handle the onBeforeRender event and get the e.component property to get the DashboardControl instance. Call the DashboardControl.unregisterExtension method and pass the extension’s unique name as a parameter. The following code unregisters the CreateDashboardExtension and removes the ‘New…’ item from the dashboard menu:

import { Component } from "@angular/core";

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {
    onBeforeRender(e){
      let dashboardControl = e.component;
      dashboardControl.unregisterExtension('createDashboard');
    }
}

Register a New Extension

Import the extension module. Register an extension in the beforeRender event handler. Use the e.component property to get the DashboardControl instance. Pass the extension instance as the control’s registerExtension method parameter.

The code below registers the imported DashboardPanelExtension and the HelloWorld custom item from the external HelloWorld.js file:

import { Component } from "@angular/core";
import { DashboardPanelExtension } from 'devexpress-dashboard/common';
import HelloWorldItem from './HelloWorld';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {
    onBeforeRender(e){
        let dashboardControl = e.component;
        dashboardControl.registerExtension(new DashboardPanelExtension(dashboardControl));
        dashboardControl.registerExtension(new HelloWorldItem(dashboardControl));
    }
}

More Examples

The following topic describes how to register the TextBoxItemEditorExtension: Enable Text Editor Functionality

View the DevExpress.Dashboard.Designer module to find extensions used in the Web Dashboard when it operates as a designer. The DevExpress.Dashboard contains extensions used both in Designer and Viewer modes.