Depending on the size of your data, the report function can run for several seconds or minutes, just like reports in the JasperReports Server UI. You can listen for events that give the status of running reports and display pages sooner.
This chapter contains the following sections:
• | Tracking Completion Status |
• | Listening to Page Totals |
• | Listening for the Last Page |
• | Customizing a Report's DOM Before Rendering |
Tracking Completion Status
By listening to the reportCompleted event, you can give information or take action when a report finishes rendering.
Listening to Page Totals
By listening to the changeTotalPages event, you can track the filling of the report.
Listening for the Last Page
Listening to the pageFinal event, let's you know when the last page of a running report has been generated.
Customizing a Report's DOM Before Rendering
By listening to the beforeRender event, you can access the Document Object Model (DOM) of the report to view or modify it before it is displayed. In the example the listener finds span elements and adds a color style and an attribute my-attr="test" to each one.
The HTML page that displays the report uses a static list of reports in a drop-down selector, but otherwise needs only a container element. This is similar to the basic report example in Rendering a Report, except that the JavaScript above will change the report before it's displayed.
Recommended Comments
There are no comments to display.