DxResource.Position Property
Specifies the resource position in the Resource Manager’s script collection.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.Resources.v24.2.dll
NuGet Package: DevExpress.Blazor.Resources
Declaration
public int Position { get; set; }
Property Value
Type | Description |
---|---|
Int32 | The position in the collection. |
Remarks
The Resource Manager automatically registers client DevExpress resources based on installed NuGet packages.
The following table lists public DevExpress resources, their positions among other scripts, and NuGet packages that include these scripts:
Position | DevExpress Resource | NuGet Packages |
---|---|---|
0 | DevExpress.Blazor.Dashboard | |
150 | DevExpress.Blazor | |
200 | DevExpress.Blazor | |
300 | DevExpress.Blazor.Dashboard | |
400 | DevExpress.Blazor.Dashboard | |
500 | DevExpress.Blazor.Dashboard | |
600 | DevExpress.Blazor.Dashboard | |
700 | DevExpress.Blazor.Reporting.JSBasedControls | |
700 | DevExpress.Blazor.Dashboard | |
800 | DevExpress.Blazor.Reporting.JSBasedControls | |
800 | DevExpress.Blazor.Dashboard |
If you want to register a specific version of a DevExpress resource, start by removing the standard version, then place the new version in the position where the standard version was. Custom scripts should be registered after DevExpress resources:
@DxResourceManager.RegisterScripts((config) => {
var maxScriptPosition = config.Resources.OrderBy(o => o.Position).Last().Position;
config.Register(new DxResource("my-custom-script.js", maxScriptPosition + 1));
})
If you want to register a custom script, call the LoadDxResources(IJSRuntime) method before you access the script’s API members for the first time. This method forces the Resource Manager to load client resources:
// ...
@code {
[Inject] IJSRuntime js;
protected override async Task OnAfterRenderAsync(bool firstRender) {
if(firstRender) {
await js.LoadDxResources();
await js.InvokeAsync("a-method-from-a-custom-script");
}
await base.OnAfterRenderAsync(firstRender);
}
}
Refer to the following topic for more information: DxResourceManager.