dashboard-js-devexpress-dot-dashboard-614a4578.md
Provides options to configure the DashboardControl.
export interface DashboardControlOptions
You can configure the DashboardControl‘s options when you call a constructor. The code snippet below shows how to specify multiple options when you create the DashboardControl:
<dx-dashboard-control
endpoint="http://localhost:5000/api/dashboard"
workingMode="ViewerOnly"
dashboardId="dashboard1"
>
</dx-dashboard-control>
<DashboardControl
endpoint="http://localhost:5000/api/dashboard"
workingMode="ViewerOnly"
dashboardId="dashboard1"
></DashboardControl>
<DxDashboardControl
endpoint="http://localhost:5000/api/dashboard"
workingMode="ViewerOnly"
dashboardId="dashboard1"
></DxDashboardControl>
var dashboardControl = new DevExpress.Dashboard.DashboardControl(document.getElementById("web-dashboard"), {
endpoint: "http://localhost:5000/api/dashboard",
workingMode: "ViewerOnly",
dashboardId: "dashboard1"
});
Call the option method to get or update the values of the DashboardControl‘s options.
To configure extensions, use the extensions property.
Specify the fetchRemoteService property to configure headers.
Specifies the Ajax-based remote service options used to communicate with the server side.
ajaxRemoteService?: DevExpress.Dashboard.AjaxRemoteServiceOptions
| Type | Description |
|---|---|
| AjaxRemoteServiceOptions |
The object that provides access to the Ajax-based remote service’s options.
|
Specifies whether end users can maximize dashboard items.
allowMaximizeItems?: boolean
| Type | Description |
|---|---|
| boolean |
true , to allow maximizing dashboard items; otherwise, false.
|
Specifies the identifier of the dashboard to be opened in the DashboardControl.
dashboardId?: string
| Type | Description |
|---|---|
| string |
A string value that specifies the dashboard identifier.
|
The initialDashboardId and dashboardId properties are used to load a dashboard with the specified identifier from the dashboard storage.
You can use the initialDashboardId option before the control is rendered. You cannot change the initialDashboardId property value after the control is ready. To change a dashboard, pass the dashboard identifier to the dashboardId property.
Use the DashboardControl.getDashboardId method to get the identifier of the loaded dashboard.
Specifies an item’s data request mode for a dashboard.
dataRequestOptions?: DataRequestOptions
| Type | Description |
|---|---|
| DataRequestOptions |
A DataRequestOptions value used to specify a data request mode for a dashboard.
|
When a Web Dashboard loads data, it groups data dashboard items by master-filter items. While dashboard data is loading, the group waits when its master-filter item is loaded and then performs simultaneous separate requests for each dashboard item in this group. A blocking item temporarily blocks data receiving for detailed items: data for detailed items depends on the data from blocking items (it is the Range Filter item, single master-filter items, and filter items when the neutral filter mode is disabled).
This behavior allows you to render lightweight items with little loading time, while heavy dashboard items with long loading time are waiting for a response. In certain cases, this is not optimal behavior. For example, in Web Forms, parallel query processing is disabled. In this case, the batch requests mode allows you to improve performance when items grouped by one master-filter item are send in a one request.
Specifies whether the DashboardControl‘s value and element content are rendered as pure HTML, or HTML markers are stripped out.
encodeHtml?: boolean
| Type | Description |
|---|---|
| boolean |
true if the HTML code contained within the DashboardControl’s value and element content are not executed and are converted into the corresponding text for display purposes; false if the web control’s value and element content can contain pure HTML code.
|
Specifies the URL used by the DashboardControl to send data requests to a server.
endpoint?: string
| Type | Description |
|---|---|
| string |
A string value that specifies the endpoint URL prefix used to send data requests to a server.
|
The endpoint property specifies the URL used to interact with a backend (to send data requests to a server). The value should consist of a base URL where the Web Dashboard’s server side is hosted and a route prefix - a value that is set in the MVC / .NET Core MapDashboardRoute properties. The following code snippet shows how to set the URL used by the DashboardControl to send data requests to a server:
window.onload = function () {
var dashboardControl = new DevExpress.Dashboard.DashboardControl(document.getElementById("web-dashboard"), {
endpoint: "{baseURL}/api/dashboard",
});
dashboardControl.render();
};
To learn how to perform server-side configuration to allow the DashboardControl to interact with a backend, see the following topics:
Note
If you use the ASP.NET Web Forms, ASP.NET MVC, or ASP.NET Core controls as a client, use the DashboardBackendOptions class to configure the backend options.
You cannot change the endpoint property value using the DashboardControl.option method. Set this property before the control is rendered.
Specifies the registered extension options.
extensions?: ExtensionOptions | false
| Name | Description |
|---|---|
| "False" |
Removes all registered extensions. Do not set it after the control is rendered.
| | ExtensionOptions |
The object that provides access to the extension’s options.
|
Call the option(args) method to manage extension options.
See the following topics for an example that shows how to configure the extension’s options:
Specifies the Fetch-based remote service options used to communicate with the server side.
fetchRemoteService?: DevExpress.Dashboard.FetchRemoteServiceOptions
| Type | Description |
|---|---|
| FetchRemoteServiceOptions |
The object that provides access to Fetch-based remote service options.
|
See the following topics for an example that shows how to configure headers:
Specifies the identifier of the dashboard to be loaded to the DashboardControl before the control is rendered.
initialDashboardId?: string
| Type | Description |
|---|---|
| string |
A string value that specifies the dashboard identifier.
|
The initialDashboardId and dashboardId properties are used to load a dashboard with the specified identifier from the dashboard storage.
You can use the initialDashboardId option before the control is rendered. You cannot change the initialDashboardId property value after the control is ready. To change a dashboard, pass the dashboard identifier to the dashboardId property.
Specifies the initial state of the loaded dashboard.
initialDashboardState?: string
| Type | Description |
|---|---|
| string |
A string value that specifies the dashboard state saved in JSON format.
|
Use the initialDashboardId option to set the identifier of the dashboard to which the state is applied.
To specify the initial dashboard state, initialize the DashboardState object on a server, save this object to JSON using the DashboardStateExtensions.SaveToJson extension method and assign the resulting string to the initialDashboardState property.
The following code shows how to pass a string that contains a dashboard state saved in JSON format to the initialDashboardState property:
var dashboardControl = new DashboardControl(this.element.nativeElement.querySelector(".dashboard-container"), {
endpoint: "https://demos.devexpress.com/services/dashboard/api",
workingMode: "Viewer",
initialDashboardState: "{\"Items\":{\"gridSalesByState\":{\"MasterFilterValues\":[[\"Nevada\"]]}}}",
});
See Also
Manage Dashboard State in JavaScript Applications
Specifies a data limitation mode that allows you to display a reduced form of visible data.
limitVisibleDataMode?: LimitVisibleDataMode
| Type | Default | Description |
|---|---|---|
| LimitVisibleDataMode | Designer |
A LimitVisibleDataMode value that is the data limitation mode.
|
If a dashboard item is bound to a large dataset, the Web Dashboard limits visible data to speed up the rendering of the visual elements when you design a dashboard. First, the dashboard control obtains the underlying data and performs all required calculation. After the calculation process, the control renders the visual elements. At this point, if the number of the data item’s unique values is larger than a certain number N, the dashboard control uses only the first N values to render the elements. The number varies for each dashboard item.
The image below shows the difference between a chart that displays limited visible data and a chart that displays all data:
Initially, the Web Dashboard limits visible data only in Designer mode. To change the settings, specify the limitVisibleDataMode property value:
window.onload = function () {
var dashboardControl = new DevExpress.Dashboard.DashboardControl(document.getElementById("web-dashboard"), {
endpoint: "/dashboardControl",
limitVisibleDataMode: "DesignerAndViewer",
});
dashboardControl.render();
};
For more information on visible data limitation, refer to the following topic: Limit Visible Data.
See Also
Specifies whether the default dashboard should be loaded from the dashboard storage.
loadDefaultDashboard?: boolean
| Type | Description |
|---|---|
| boolean |
true , to load the default dashboard from the dashboard storage; otherwise, false.
|
Note that the loadDefaultDashboard property is in effect if initialDashboardId / dashboardId is not set. Otherwise, the control loads a dashboard with the specified identifier.
You cannot change the loadDefaultDashboard property value using the DashboardControl.option method. Set this property before the control is rendered.
Specifies the nonce value.
nonce?: string
| Type | Description |
|---|---|
| string |
A string that specifies the nonce value.
|
A handler for the event that occurs before any element in the Web Dashboard control has been rendered.
onBeforeRender?: (args: DashboardControlArgs) => void
| Type | Description |
|---|---|
| (args: DashboardControlArgs) => void |
A function that is executed before any element in the Web Dashboard control has been rendered.
|
A handler for the event that occurs when a dashboard update is initiated.
onDashboardBeginUpdate?: (args: DashboardUpdateArgs) => void
| Type | Description |
|---|---|
| (args: DashboardUpdateArgs) => void |
A function that is executed when a dashboard update is initiated.
|
A handler for the event that occurs after the dashboard update is performed.
onDashboardEndUpdate?: (args: DashboardUpdateArgs) => void
| Type | Description |
|---|---|
| (args: DashboardUpdateArgs) => void |
A function that is executed after the dashboard update is performed.
|
A handler for the event that occurs after the dashboard displayed in the control has been initialized.
onDashboardInitialized?: (args: DashboardInitializedArgs) => void
| Type | Description |
|---|---|
| (args: DashboardInitializedArgs) => void |
A function that is executed after the dashboard displayed in the control has been initialized.
|
A handler for the event that occurs before the dashboard displayed in the control has been initialized.
onDashboardInitializing?: (args: DashboardInitializingArgs) => void
| Type | Description |
|---|---|
| (args: DashboardInitializingArgs) => void |
A function that is executed before the dashboard displayed in the control has been initialized.
|
Use the dashboardInitializing event when you need to customize the dashboard before it is displayed.
Use the following event handlers depending on the platform:
A handler for the event that occurs after the current dashboard state in the Web Dashboard is changed.
onDashboardStateChanged?: (args: DashboardStateChangedArgs) => void
| Type | Description |
|---|---|
| (args: DashboardStateChangedArgs) => void |
A function that is executed after the state of the dashboard displayed in the Web Dashboard is changed.
|
See Also
Manage Dashboard State in JavaScript Applications
A handler for the event that occurs after the control has been initialized and before the control has been rendered.
onInitializing?: (args: DashboardControlArgs) => void
| Type | Description |
|---|---|
| (args: DashboardControlArgs) => void |
A function that is executed after the control has been initialized and before the control has been rendered.
|
A handler for the event that occurs when a dashboard item update is initiated.
onItemBeginUpdate?: (args: DashboardItemUpdateArgs) => void
| Type | Description |
|---|---|
| (args: DashboardItemUpdateArgs) => void |
A function that is executed when a dashboard item update is initiated.
|
A handler for the event that occurs after the dashboard item update is performed.
onItemEndUpdate?: (args: DashboardItemUpdateArgs) => void
| Type | Description |
|---|---|
| (args: DashboardItemUpdateArgs) => void |
A function that is executed after the dashboard item update is performed.
|
A handler for the event that occurs after a widget option is changed.
onOptionChanged?: (args: DashboardOptionChangedArgs<DashboardControlOptions>) => void
| Type | Description |
|---|---|
| (args: DashboardOptionChangedArgs<DashboardControlOptions>) => void |
A function that is executed after a widget option is changed.
|
The DashboardOptionChangedArgs<T> contains the event arguments.
Specifies whether to redraw the DashboardControl when the size of a container is changed.
resizeByTimer?: boolean
| Type | Description |
|---|---|
| boolean |
true , to redraw the DashboardControl when the size of the a container is changed; otherwise, false.
|
The DashboardControl redraws itself when the size of its parent container is changed. You can set the resizeByTimer property to false to disable automatic redrawing. In this case, call the repaint method to redraw the DashboardControl.
Specifies whether to show a browser warning if an end-user attempts to leave the page with unsaved data.
showConfirmationOnBrowserClosing?: boolean
| Type | Description |
|---|---|
| boolean |
true , to show dialog; otherwise, false.
|
You cannot change the showConfirmationOnBrowserClosing property value using the DashboardControl.option method. Set this property before the control is rendered.
Specifies whether to enable the legacy card layout used prior to v17.1.
useCardLegacyLayout?: boolean
| Type | Description |
|---|---|
| boolean |
true , to enable the legacy card layout used prior to v17.1; otherwise, false.
|
With v17.1 and later, the Card dashboard item allows you to arrange elements within individual cards using different layout types (Stretched, Compact, etc.). By default, the Card dashboard item uses the Stretched layout type that arranges card elements so that they occupy an entire card area.
The useCardLegacyLayout property allows you to create cards in a legacy layout using the Designer mode of the Web Dashboard.
You cannot change the useCardLegacyLayout property value using the DashboardControl.option method. Set this property before the control is rendered.
Note
Note that if you load a dashboard XML file created before v17.1, cards will be displayed in the old layout. To display such cards using the new layout, specify the required layout type in the UI or in code.
Note
Cards that use a legacy layout do not support conditional formatting.
Specifies whether to show all items in the filter elements deselected by default.
useNeutralFilterMode?: boolean
| Type | Description |
|---|---|
| boolean |
true to activate Neutral Filter Mode; otherwise, false.
|
The standard filter mode shows all items in the filter elements selected. An additional click is required to begin any actual filtering operation. This is not an optimal implementation for performance reasons, because it generates filtering criteria that are evaluated by the data layer and/or the database.
The neutral filter mode does not apply any criteria to the data source in its default state, resulting in improved performance.
See Neutral Filter Mode to learn more about the neutral filter mode.
Specifies the Web Dashboard control’s working mode.
workingMode?: WorkingMode
| Type | Description |
|---|---|
| WorkingMode |
A value that specifies the Web Dashboard control’s working mode.
|
Use the isDesignMode property to get a value that indicates whether the Web Dashboard works in the Designer mode.
The code below shows how to specify the Web Dashboard’s working mode in a constructor:
```html
<head>
<!-- ...-->
<script>
window.onload = function () {
var dashboardControl = new DevExpress.Dashboard.DashboardControl(document.getElementById("web-dashboard"), {
endpoint: "/api/dashboard",
workingMode: "Viewer" // Enables the Viewer mode.
});
dashboardControl.render();
};
</script>
</head>