ResourceManager Class
A class containing methods used to manage dashboard control static content.
Declaration
export class ResourceManager
Methods
embedBundledResources Method
Obsolete. This method has no effect in v24.2 and later.
Declaration
static embedBundledResources(): void
Remarks
Warning
The ResourceManager.embedBundledResources()
method became obsolete in v24.2. Remove the method call from your application. For more information, refer to the following breaking change document: Web Dashboard - The approach for storing SVG and HTML templates has changed.
registerIcon(icon) Method
Embeds an icon’s SVG definition onto the page.
Declaration
static registerIcon(
icon: string | HTMLElement,
id?: string
): void
Parameters
Name | Type | Description |
---|---|---|
icon | string | HTMLElement | A string or HTML object that stores the icon’s definition. |
id | string | (Optional) The icon’s id. |
Remarks
Use the registerIcon
method as an alternative variant to add an icon to the page. Make sure the following requirements are met:
- The icon consists of a single SVG element.
- The SVG element has an
id
attribute. If there is noid
attribute in the icon’s definition, pass the icon’s id as the second parameter to theregisterIcon
method.
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);
}
Tip
See Predefined Colors for information on which color constants you can use to natively embed an icon in the Web Dashboard application.
removeEmbeddedResources Method
Obsolete. This method has no effect in v24.2 and later.
Declaration
static removeEmbeddedResources(): void
Remarks
Warning
The ResourceManager.removeEmbeddedResources()
method became obsolete in v24.2. Remove this method call from your application. For more information, refer to the following breaking change document: Web Dashboard - The approach for storing SVG and HTML templates has changed.
setLocalizationMessages(localizationMessages) Method
Allows you to define dashboard localization strings.
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.
<head>
<!-- ...-->
<script>
DevExpress.Dashboard.ResourceManager.setLocalizationMessages({ "DashboardStringId.ActionExportTo": "Custom Text for Export Button" });
window.onload = function () {
var dashboardControl = new DevExpress.Dashboard.DashboardControl(document.getElementById("web-dashboard"), {
endpoint: "https://demos.devexpress.com/services/dashboard/api"
});
dashboardControl.render();
};
</script>
</head>