How to Destroy the Report Viewer Object
To destroy the Bold Reports® Blazor Report Viewer object, add a DisposeReportsObject function to the boldreports-interop.js file and invoke it through JavaScript interop when the Razor component is disposed.
-
Add the following code in the boldreports-interop.js file to destroy the Report Viewer object.
window.DisposeReportsObject = () => { var reportViewerElement = document.querySelector('.e-reportviewer.e-js'); if (reportViewerElement) { //Destroy the report viewer processing objects. $(reportViewerElement).data('boldReportViewer').destroy(); } return true; } -
Invoke the
DisposeReportsObjectfunction in thePages/Index.razorfile, as in the following code:@page "/" @implements IDisposable @code { void IDisposable.Dispose() { // Unsubscribe from the event when our component is disposed JSRuntime.InvokeAsync<bool>("DisposeReportsObject").GetAwaiter(); } }