Showing a Report in the Viewer
Our sample projects and report templates can help you learn the basics of working with our products.Stimulsoft Reports.Python is a native Python library: the server configures a viewer and report, and the JavaScript viewer is emitted into the page.
Build the viewer in a Flask view.
How it works. Python configures and wires the component, but rendering happens client-side, so the same view both serves the page and answers its callbacks.
Build the viewer in a Flask view.
viewer = StiViewer()
# Return the processed request (data, events) to the client
if viewer.processRequest(request):
return viewer.getFrameworkResponse()
report = StiReport()
report.loadFile(url_for('static', filename='reports/SimpleList.mrt'))
viewer.report = report
return viewer.getFrameworkResponse()viewer.processRequest(request)— handles the viewer's AJAX callbacks; when it returns true, return its response.report.loadFile(url)— emits JS to load the template; the report loads in the browser, not on the server.viewer.getFrameworkResponse()— returns the ready HTML page (or component) for Flask to serve.
How it works. Python configures and wires the component, but rendering happens client-side, so the same view both serves the page and answers its callbacks.