SaveDashboardExtension Class

A Web Dashboard extension that allows you to save the current dashboard.

Declaration

export class SaveDashboardExtension implements IExtension

Remarks

When registered, the SaveDashboardExtension adds the “Save” item to the dashboard menu.

To get access to the SaveDashboardExtension settings, call the control’s findExtension(extensionName) method and pass the extension’s name as a parameter.

var ext = dashboardControl.findExtension('save-dashboard');

To remove this item from the menu, call the unregisterExtension(extensionNames) method and pass the extension’s name:

dashboardControl.unregisterExtension('saveDashboard');

Note

Use the saveDashboard 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 save-dashboard. You can use the old name only in the DashboardControl.findExtension method.

Implements

constructor(dashboardControl)

Initializes a new instance of the SaveDashboardExtension class.

Declaration

constructor(
    dashboardControl: DashboardControl
)

Parameters

Name Type Description
dashboardControl DashboardControl

A Web Dashboard control that owns the extension.

Properties

canSaveDashboard Property

Declaration

canSaveDashboard: ko.Computed<boolean>

Property Value

Type
Computed<boolean>

designerToViewerAction Property

Specifies an action executed at the moment of switching from Designer to Viewer.

Declaration

designerToViewerAction: SequenceAction

Property Value

Type Description
SequenceAction

An action executed at the moment of switching from Designer to Viewer.

name Property

Specifies the unique extension name.

Declaration

name: string

Property Value

Type Description
string

The unique extension name. The return value is saveDashboard.

Remarks

Use the saveDashboard 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 save-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.

Methods

ensureDashboardSaved(action) Method

Allows you to invoke a custom function while you save a dashboard.

Declaration

ensureDashboardSaved(
    action: () => void
): void

Parameters

Name Type Description
action () => void

A function that is executed when the dashboard is about to be saved.

performSaveDashboard(dashboardId, dashboardJson) Method

Calls the saveDashboard method.

Declaration

performSaveDashboard(
    dashboardId: string,
    dashboardJson: string
): JQueryPromise<any>

Parameters

Name Type Description
dashboardId string

A string that identifies the dashboard.

dashboardJson string

A dashboard model encoded in the JSON format.

Returns

Type Description
JQueryPromise<any>

A JQuery Promise object that is resolved after the action is completed.

saveDashboard Method

Saves the current dashboard.

Declaration

saveDashboard(): JQueryPromise<any>

Returns

Type Description
JQueryPromise<any>

A JQuery Promise object that is resolved after the dashboard is saved.

start Method

Contains code that is executed when you register the dashboard extension.

Declaration

start(): void

stop Method

Contains code that is executed when you unregister the dashboard extension.

Declaration

stop(): void