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

Type Name Description
string icon

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"><path fill="#39A866" 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);
    }

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

Type Name Description
{[localizationStringId: string]: string} localizationMessages

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 () {
        js-DevExpress.Dashboard.ResourceManager.embedBundledResources();
        js-DevExpress.Dashboard.ResourceManager.setLocalizationMessages({
            "DashboardStringId.ActionExportTo": "Export, please!"
        });

        // ...

        dashboardControl.render();
    }
</script>