How to Control Report Rendering Using the autoRender Property in Bold Reports Viewer
Published:
Updated:
The autoRender property in the Bold Reports Viewer allows you to control whether a report renders automatically when the viewer loads. By default, reports that contain optional parameters or parameters with default values are rendered immediately.
This article explains how to set autoRender to false to delay report rendering until parameter values are verified by the user. This approach improves user interaction and prevents unnecessary data processing for report designers and developers.
Step-by-Step Instructions
1. Initialize the Report Viewer with the autoRender Property
- Add the following JavaScript code to your HTML file to initialize the Bold Reports Viewer. Set the
autoRenderproperty tofalsein the configuration object.$(function () { $("#viewer").boldReportViewer({ // Service URL for the Report Viewer API reportServiceUrl: "https://demos.boldreports.com/services/api/ReportViewer", // The path to the RDL (Report Definition Language) report file reportPath: '~/Resources/docs/sales-order-detail.rdl', // Prevents automatic rendering on load autoRender: false, }); });Property Description autoRender: falsePrevents the report from rendering automatically. The viewer waits until parameter values are provided and the View Report button is clicked.
2. Verify the Initialization
- After running the application, the report content area remains empty or displays a loading placeholder. The parameter panel appears, allowing you to select the required input values.
3. Render the Report
- Select the required parameter values in the panel and click the View Report button. The report then retrieves the data and displays the results based on your selection.
You can download the sample application here.