dashboard-js-devexpress-dot-dashboard-dot-designer-48367ca7.md
The Web Dashboard Toolbox extension that provides access to the dashboard menu and allows you to add dashboard items, as well as undo or repeat user actions.
export class ToolboxExtension extends DisposableObject implements IExtension
The ToolboxExtension class provides access to the Toolbox and allows you to customize it using the client-side API.
To get access to the ToolboxExtension settings, call the control’s findExtension(extensionName) method and pass the extension’s name as a parameter.
var ext = dashboardControl.findExtension('toolbox');
To disable the current panel, call the unregisterExtension(extensionNames) method and pass the extension’s unique name as a parameter:
dashboardControl.unregisterExtension('toolbox');
You can also call the control’s option method to change the extension options.
IExtension
DisposableObject ToolboxExtension
Initializes a new instance of the ToolboxExtension class.
constructor(
dashboardControl: DevExpress.Dashboard.DashboardControl
)
| Name | Type | Description |
|---|---|---|
| dashboardControl | DashboardControl |
A Web Dashboard control that owns the extension.
|
Adds a menu item to the dashboard menu.
addMenuItem: (menuItem: DevExpress.Dashboard.Designer.DashboardMenuItem) => void
| Type | Description |
|---|---|
| (menuItem: DashboardMenuItem) => void |
A function that passes the DashboardMenuItem object to create a dashboard menu item.
|
Create a new DashboardMenuItem class instance and pass it to the addMenuItem method to add a new item to the dashboard menu:
var customMenuItem = new DevExpress.Dashboard.DashboardMenuItem('customItem1', 'New Menu Item', 0, 20, function () { /* ... */ });
dashboardControl.findExtension('toolbox').addMenuItem(customMenuItem);
Adds a toolbar item to the Toolbox.
addToolbarItem: (groupName: string, toolbarItem: DevExpress.Dashboard.Designer.DashboardToolbarItem) => void
| Type | Description |
|---|---|
| (groupName: string, toolbarItem: DashboardToolbarItem) => void |
A function that passes the toolbar group name and DashboardToolbarItem object to create a toolbox item.
|
Create a new DashboardToolbarItem class instance and pass it with a group name to the addToolbarItem property to add a new item to the specified Toolbar‘s group:
var toolbarItem = new DevExpress.Dashboard.Designer.DashboardToolbarItem('toolbarItem1', function () { /* ... */ }, "toolbox-icon");
dashboardControl.findExtension('toolbox').addToolbarItem('undoRedo', toolbarItem);
Adds a new item to the Toolbox.
addToolboxItem: (groupName: string, toolboxItem: DevExpress.Dashboard.Designer.DashboardToolboxItem) => void
| Type | Description |
|---|---|
| (groupName: string, toolboxItem: DashboardToolboxItem) => void |
A function that passes the toolbox group name and DashboardToolboxItem object to create a toolbox item.
|
Create a new DashboardToolboxItem class instance and pass it with a group name to the addToolboxItem property to add a new item to the specified Toolbox‘ group:
var toolboxItem = new DevExpress.Dashboard.Designer.DashboardToolboxItem('toolboxGroup', function () { /* ... */ }, "toolbox-icon");
dashboardControl.findExtension('toolbox').addToolboxItem("common", toolboxItem);
Specifies an action executed at the moment of switching from Designer to Viewer.
designerToViewerAction: DevExpress.Dashboard.SequenceAction
| Type | Description |
|---|---|
| SequenceAction |
An action executed at the moment of switching from Designer to Viewer.
|
Hides the Toolbox asynchronously.
hidePanelAsync: (options: DevExpress.Dashboard.WorkingModeSwitchingOptions) => JQueryPromise<{}>
| Type |
|---|
| (options: WorkingModeSwitchingOptions) => JQueryPromise<> |
The code below hides the Toolbox asynchronously and then adjusts the left indent of the DashboardControl using the surfaceLeft property.
function hideToolbox() {
// The dashboardControl variable is the obtained DashboardControl instance.
var toolbox = dashboardControl.findExtension('toolbox');
toolbox.hidePanelAsync({}).done(function (e) {
dashboardControl.surfaceLeft(e.surfaceLeft);
});
}
Provides access to the dashboard menu’s items collection.
menuItems: ko.ObservableArray<DevExpress.Dashboard.Designer.DashboardMenuItem>
| Type | Description |
|---|---|
| ObservableArray<DashboardMenuItem> |
A collection the DashboardMenuItem objects that are the dashboard menu items.
|
Use the menuItems property to get a list of the DashboardMenuItem objects and manage the collection. For example, the code below removes the “New…” menu item:
var toolbox = dashboardControl.findExtension('toolbox');
var itemCreate = toolbox.menuItems().filter(item => item.id === "create-dashboard")[0];
toolbox.menuItems.remove(itemCreate);
Gets the visibility status of the dashboard menu.
get menuVisible(): ko.Observable<boolean>
| Type | Description |
|---|---|
| Observable<boolean> |
true , if the dashboard menu is displayed; otherwise, false.
|
Use the openMenu / closeMenu methods to open / close the dashboard menu from code.
Specifies the unique extension name.
name: string
| Type |
|---|
| string |
Warning
Do not change the unique name of the extension registered in the Web Dashboard to avoid exceptions.
Removes the specified dashboard item from the dashboard menu.
removeMenuItem: (menuItemId: string) => void
| Type | Description |
|---|---|
| (menuItemId: string) => void |
A DashboardMenuItem.id value that is passed as a parameter.
|
The following code snippet shows you how to remove the Open… item from the dashboard menu:
var toolbox = dashboardControl.findExtension('toolbox');
toolbox.removeMenuItem("open-dashboard");
Use the id property value to address the menu item.
Removes the specified toolbar item from the specified toolbar group.
removeToolbarItem: (groupName: string, toolbarItemName: string) => void
| Type | Description |
|---|---|
| (groupName: string, toolbarItemName: string) => void |
The DashboardToolbarGroup.name and DashboardToolbarItem.name values that are passed as parameters.
|
Use the name and name property values to obtain the toolbar item and group names, respectively.
Removes the specified toolbox item from the specified toolbox group.
removeToolboxItem: (groupName: string, toolboxItemName: string) => void
| Type | Description |
|---|---|
| (groupName: string, toolboxItemName: string) => void |
The DashboardToolboxGroup.name and DashboardToolbarItem.name values that are passed as parameters.
|
The code snippet below shows how to delete the ‘Grid’ item from the Toolbox.
toolbox.removeToolboxItem("common", "Grid");
Use the name and name property values to obtain the toolbox item and group names, respectively.
Selects a menu item in the dashboard menu.
selectMenuItem: (menuItem: DevExpress.Dashboard.Designer.DashboardMenuItem) => void
| Type | Description |
|---|---|
| (menuItem: DashboardMenuItem) => void |
A function that takes a DashboardMenuItem object to be selected.
|
To show a custom menu item, call the openMenu function of the toolbox extension:
function onDashboardInitialized(s, args) {
var toolbox = s.GetDashboardControl().findExtension("toolbox");
toolbox.openMenu();
toolbox.selectMenuItem(toolbox.menuItems().filter(item => item.id === "dashboard-save-as")[0]);
}
Shows the Toolbox asynchronously.
showPanelAsync: (options: DevExpress.Dashboard.WorkingModeSwitchingOptions) => JQueryPromise<{}>
| Type | Description |
|---|---|
| (options: WorkingModeSwitchingOptions) => JQueryPromise<> |
The WorkingModeSwitchingOptions object that returns a JQuery promise.
|
The code below shows the Toolbox asynchronously and then adjusts the left indent of the DashboardControl using the surfaceLeft property.
function showToolbox() {
// The dashboardControl variable is the obtained DashboardControl instance.
var toolbox = dashboardControl.findExtension('toolbox');
toolbox.showPanelAsync({}).done(function (e) {
dashboardControl.surfaceLeft(e.surfaceLeft);
});
}
Specifies a custom template for the Toolbox.
template: DevExpress.Dashboard.KnockoutTemplate
| Type | Description |
|---|---|
| KnockoutTemplate |
An object that defines a template.
|
Provides an access to the toolbar groups collection obtained from the Toolbox.
toolbarGroups: ko.ObservableArray<DevExpress.Dashboard.Designer.DashboardToolbarGroup>
| Type | Description |
|---|---|
| ObservableArray<DashboardToolbarGroup> |
A collection of the DashboardToolbarGroup objects that are the toolbar groups.
|
Use the toolbarGroups property to get a list of the DashboardToolbarGroup objects.
Provide an access to the collection of toolbox groups obtained from the Toolbox.
toolboxGroups: ko.ObservableArray<DevExpress.Dashboard.Designer.DashboardToolboxGroup>
| Type | Description |
|---|---|
| ObservableArray<DashboardToolboxGroup> |
A collection of the DashboardToolboxGroup objects that are the toolbox groups.
|
Use the toolboxGroups property to get a list of the DashboardToolboxGroup objects.
Specifies an action executed at the moment of switching from Viewer to Designer.
viewerToDesignerAction: DevExpress.Dashboard.SequenceAction
| Type | Description |
|---|---|
| SequenceAction |
An action executed at the moment of switching from Viewer to Designer.
|
Closes the dashboard menu.
closeMenu(): void
The following code shows how to close a dashboard menu:
var toolbox = dashboardControl.findExtension('toolbox');
toolbox.closeMenu();
Use the openMenu method to show the dashboard menu. The menuVisible property indicates whether the menu is opened.
Opens the dashboard menu.
openMenu(): void
The following code shows how to open a dashboard menu:
var toolbox = dashboardControl.findExtension('toolbox');
toolbox.openMenu();
Use the closeMenu method to hide the dashboard menu. The menuVisible property indicates whether the menu is opened.
Allows you to process which key was pressed.
processKeyEvent(
keyEventType: DevExpress.Dashboard.KeyEventType,
eventArgs: JQueryKeyEventObject
): boolean
| Name | Type | Description |
|---|---|---|
| keyEventType | KeyEventType | |
| eventArgs | JQueryKeyEventObject |
A JQueryKeyEventObject object that identifies a key.
|
| Type | Description |
|---|---|
| boolean |
true , if a key used to open the dashboard menu; otherwise, false.
|
Contains code that is executed when you register the dashboard extension.
start(): void
Contains code that is executed when you unregister the dashboard extension.
stop(): void