Rendering a Report from Code
Our sample projects and report templates can help you learn the basics of working with our products.A report can be rendered from Python code and reacted to when rendering completes, via the
Load, render, and handle completion.
How it works. Python only generates the engine code; the report is built in the browser, and the event signals when it is ready.
onAfterRender event.Load, render, and handle completion.
report = StiReport()
report.onAfterRender += 'afterRender'
if report.processRequest(request):
return report.getFrameworkResponse()
report.loadFile(url_for('static', filename='reports/SimpleList.mrt'))
report.render()
js = report.javascript.getHtml()
html = report.getHtml()
return render_template('...html', reportJavaScript=js, reportHtml=html)report.render()— emits the JS that builds the report on the client; nothing renders server-side.onAfterRender— fires when the client-side build finishes, so you can inspect or display the result.
How it works. Python only generates the engine code; the report is built in the browser, and the event signals when it is ready.