What Changed
In v24.2, we introduced a unified resource management system for our Blazor components. The DxResourceManager.RegisterScripts()
method is now used to register DevExpress client resources and/or custom scripts.
With the introduction of a unified resource management system, the load order of the DevExtreme and jQuery libraries has changed — DevExtreme is now loaded without JQuery integration. For more information, refer to the following Breaking Change article: Dashboard for Blazor - DevExtreme integration with jQuery is now initially disabled.
Reasons for Change
In v24.1 and earlier, DevExpress Blazor components used different instances of DevExtreme, Knockout, and jQuery scripts. As a result, there could be more than one instance of the same script on a single page. This would increase the page size and could lead to issues.
In v24.2, all DevExpress Blazor and DevExtreme components now use the same version of the DevExtreme script. Each page includes only one DevExtreme script.
For more information, refer to the following Breaking Change document: The mechanism of adding DevExtreme into Blazor applications has changed.
Impact on Existing Apps
The change affects your application if you handled the OnScriptsLoading
event in your application.
How to Update Existing Apps
Dashboard Component for Blazor
If you used the OnScriptsLoading
event to register custom scripts (for example, a custom item), use the Register
method instead:
v24.1 and earlier:
Razor@page "/"
<DxDashboard Endpoint="api/dashboard" style="width: 100%; height: 650px;" WorkingMode="WorkingMode.Viewer">
<DxJSCustomization OnScriptsLoading="OnDashboardScriptsLoading"></DxJSCustomization>
</DxDashboard>
@code{
public void OnDashboardScriptsLoading(ScriptsLoadingEventArgs e) {
e.Scripts.Add("/parameter-item.js");
}
}
v24.2:
Razor@page "/"
@using DevExpress.Blazor
@DxResourceManager.RegisterScripts((config) => {
config.Register(new DxResource("/parameter-item.js", 1000));
})
<DxDashboard Endpoint="api/dashboard" style="width: 100%; height: 650px;" WorkingMode="WorkingMode.Viewer">
</DxDashboard>
If you used OnScriptsLoading
to unregister scripts, use the Unregister
method instead:
v24.1 and earlier:
Razor@page "/"
<DxDashboard Endpoint="api/dashboard" style="width: 100%; height: 650px;" WorkingMode="WorkingMode.Viewer">
<DxJSCustomization OnScriptsLoading="OnDashboardScriptsLoading"></DxJSCustomization>
</DxDashboard>
@code{
public void OnDashboardScriptsLoading(ScriptsLoadingEventArgs e) {
e.Scripts.Remove(ScriptIdentifiers.JQuery);
}
}
v24.2:
Razor@page "/"
@using DevExpress.Blazor
@DxResourceManager.RegisterScripts((config) => {
config.Unregister(CommonResources.JQueryJS);
})
<DxDashboard Endpoint="api/dashboard" style="width: 100%; height: 650px;" WorkingMode="WorkingMode.Viewer">
</DxDashboard>
XAF Blazor application with Dashboards Module
In v24.1 and earlier, you could use the workaround described in the Dashboards Module Troubleshooting Guide to add both Dashboards and DevExtreme widgets to your XAF Blazor application. After upgrading the application to v24.2, the following error can occur when you open a dashboard:
The DevExtreme library is included before the Knockout library. Check the order in which the scripts appear on the page.
To fix this error, follow the instructions described in the following help topic: The "The DevExtreme library is included before the Knockout library. Check the order in which the scripts appear on the page" error message in v24.2+.