ResourceManager Class
A class containing methods used to manage dashboard control static content.
Declaration
export class ResourceManager
Methods
embedBundledResources Method
Integrates dashboard control’s resources in the document object model.
Declaration
static embedBundledResources(): void
Remarks
To use the client-side Web Dashboard, you need to embed the control code inside the DOM structure. The embedBundledResources method creates a div element that generates the Web Dashboard in the HTML page. To remove the generated markup from the page, call the removeEmbeddedResources method.
registerIcon(icon) Method
Embeds an icon’s SVG definition onto the page.
Declaration
static registerIcon(
icon: string
): void
Parameters
Name | Type | Description |
---|---|---|
icon | string | A string that contains an icon’s SVG definition. |
Remarks
You can use the registerIcon method as an alternative variant to add an icon onto the page.
In your JavaScript code, declare a string variable and specify the icon’s definition.
var customItemIcon = '<svg id="customIconId" viewBox="0 0 24 24"><style type="text/css">.dx-dashboard-icon {fill:currentColor;}</style><path class="dx-dashboard-icon" d="M12 2 L2 22 L22 22 Z" /></svg>';
After that, pass the created variable as the registerIcon method’s parameter.
if(!!dashboardControl) {
dashboardControl.registerIcon(customItemIcon);
}
See Predefined Colors for information on which color constants you can use to natively embed an icon in the Web Dashboard application.
removeEmbeddedResources Method
Remove dashboard control resources from the document object model.
Declaration
static removeEmbeddedResources(): void
Remarks
To use the client-side Web Dashboard, you need to embed the control code inside the DOM structure. The embedBundledResources method creates a div element that generates the Web Dashboard in the HTML page. To remove the generated markup from the page, call the removeEmbeddedResources method.
setLocalizationMessages(localizationMessages) Method
Allows you to define a dashboard localization string.
Declaration
static setLocalizationMessages(localizationMessages: {
[localizationStringId: string]: string;
}): void
Parameters
Name | Type | Description |
---|---|---|
localizationMessages | {[localizationStringId: string]: string} | An object in a {string : string} format, where the first string is a localization string id, and the second string is a localization message. |
Remarks
The code snippet below shows how to change a localization message used in the Export To button’s tooltip.
<script>
window.onload = function () {
DevExpress.Dashboard.ResourceManager.embedBundledResources();
DevExpress.Dashboard.ResourceManager.setLocalizationMessages({
"DashboardStringId.ActionExportTo": "Export, please!"
});
// ...
dashboardControl.render();
}
</script>