Rendering a Report from Code on a Button Click
Our sample projects and report templates can help you learn the basics of working with our products.Rendering can be deferred until the user clicks a button instead of running on page load — the report is loaded up front and built on demand.
Load the report, defer the build.
How it works. Separating load from render lets the page appear instantly and build the report only when the user requests it.
Load the report, defer the build.
$report = new StiReport();
$report->javascript->relativePath = '../';
$report->onAfterRender = 'afterRender';
$report->process();
$report->loadFile('../reports/SimpleList.mrt');- The report is loaded but
render()is not called on load; a page button triggers the client-side build instead. onAfterRender— fires once the on-demand render completes, so you can react only after the user asks for it.
How it works. Separating load from render lets the page appear instantly and build the report only when the user requests it.