Creating a Custom Button on the Viewer Toolbar
Our sample projects and report templates can help you learn the basics of working with our products.Set up the report viewer in WebAssembly, load a template, and connect the component to the application.
Viewer setup. Configure the viewer, load the report, assign it to the component, and process the requests or events raised by the UI.
Viewer setup. Configure the viewer, load the report, assign it to the component, and process the requests or events raised by the UI.
@inject IJSRuntime JSRuntime
<StiBlazorViewer ID="WebViewer1" Report="@Report" OnViewerAfterRender="@OnViewerAfterRender" />
@code {
private void OnViewerAfterRender()
{
JSRuntime.InvokeVoidAsync("createButton");
}
}The OnViewerAfterRender callback fires when the viewer is ready; from it you invoke a JavaScript function (createButton) that inserts a custom button into the toolbar and wires it to your logic through the viewer's client API.