Back to Devexpress

ResourceManager Class

dashboard-js-devexpress-dot-dashboard-395a6027.md

latest3.9 KB
Original Source

ResourceManager Class

A class containing methods used to manage dashboard control static content.

Declaration

ts
export class ResourceManager

Methods

embedBundledResources Method

Obsolete. This method has no effect in v24.2 and later.

Declaration

ts
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

ts
static registerIcon(
    icon: string | HTMLElement,
    id?: string
): void

Parameters

NameTypeDescription
iconstringHTMLElement

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 no id attribute in the icon’s definition, pass the icon’s id as the second parameter to the registerIcon method.

In your JavaScript code, declare a string variable and specify the icon’s definition.

javascript
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.

javascript
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

ts
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

ts
static setLocalizationMessages(localizationMessages: {
    [localizationStringId: string]: string;
}): void

Parameters

NameTypeDescription
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.

html
<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>