Showing a Report in the Viewer in an HTML template
Our sample projects and report templates can help you learn the basics of working with our products.When you build the page with your own HTML template, the viewer's scripts and body can be emitted separately so they fit your layout.
Emit the JS and HTML parts into a template.
How it works. The component is split into script and body, letting you place the viewer anywhere inside your own Jinja template.
Emit the JS and HTML parts into a template.
viewer = StiViewer()
viewer.options.width = '1000px'
viewer.options.height = '600px'
if viewer.processRequest(request):
return viewer.getFrameworkResponse()
report = StiReport()
report.loadFile(url_for('static', filename='reports/SimpleList.mrt'))
viewer.report = report
js = viewer.javascript.getHtml()
html = viewer.getHtml()
return render_template('...html', viewerJavaScript=js, viewerHtml=html)viewer.javascript.getHtml()— the viewer's script block;viewer.getHtml()— its visual HTML.- Pass both into
render_templateso you control the surrounding page markup.
How it works. The component is split into script and body, letting you place the viewer anywhere inside your own Jinja template.