CreateDashboardExtension Class
A Web Dashboard extension that allows you to create a new dashboard.
Declaration
export class CreateDashboardExtension implements IExtension
Remarks
When registered, the CreateDashboardExtension adds the “New…” item to the dashboard menu.
To remove this item from the menu, call the unregisterExtension(extensionNames) method and pass the extension’s unique name as a parameter:
dashboardControl.unregisterExtension('createDashboard');
Implements
constructor(dashboardControl)
Initializes a new instance of the CreateDashboardExtension
class.
Declaration
constructor(
dashboardControl: DashboardControl
)
Parameters
Name | Type | Description |
---|---|---|
dashboardControl | DashboardControl | A Web Dashboard control that owns the extension. |
Properties
name Property
Specifies the unique extension name.
Declaration
name: string
Property Value
Type | Description |
---|---|
string | The unique extension name. The return value is |
Remarks
Use the createDashboard
name in your applications so you can change the extension options when calling the control’s option method. Before v20.2 the extension name was create-dashboard
. You can use the old name only in the DashboardControl.findExtension method.
Warning
Do not change the unique name of the extension registered in the Web Dashboard to avoid exceptions.
showCreateNewDashboard Property
Opens the “New…” dashboard menu page.
Declaration
showCreateNewDashboard: () => void
Property Value
Type |
---|
() => void |
Remarks
Note that the dashboard menu is available if Web Dashboard operates in the designer mode.
Methods
performCreateDashboard(dashboardName, dashboardJson) Method
Creates a new dashboard with a specified name and JSON model.
Declaration
performCreateDashboard(
dashboardName: string,
dashboardJson: string
): JQueryPromise<void>
Parameters
Name | Type | Description |
---|---|---|
dashboardName | string | The name of the created dashboard. |
dashboardJson | string | A dashboard model encoded in the JSON format. |
Returns
Type | Description |
---|---|
JQueryPromise<void> | A JQuery Promise object that is resolved after the action is completed. |
Remarks
The following code creates a copy of the opened dashboard with the New Dashboard name:
var extCreateDashboard = dashboardControl.findExtension("createDashboard");
var dashboardName = "New Dashboard";
extCreateDashboard.performCreateDashboard(dashboardName, dashboardControl.dashboard().getJSON());
To create a new dashboard, pass an empty model as a parameter:
extCreateDashboard.performCreateDashboard(dashboardName, new DevExpress.Dashboard.Model.Dashboard({}));
start Method
Registers the CreateDashboardExtension extension.
Declaration
start(): void
stop Method
Contains code that is executed when you unregister the dashboard extension.
Declaration
stop(): void