Registering a Data from Code
Our sample projects and report templates can help you learn the basics of working with our products.Data can be registered for the dashboard just before it renders, through the
Assign the event, load the dashboard.
How it works. The dashboard receives its data right before rendering, so the template need not carry its own connections.
onBeforeRender event handled in client JavaScript.Assign the event, load the dashboard.
$report = new StiReport();
$report->onBeforeRender = 'onBeforeRender';
$viewer->process();
$report->loadFile('../reports/ProductStats.mrt');
$viewer->report = $report;Build and register data in the event.function onBeforeRender(args) {
let dataSet = new Stimulsoft.System.Data.DataSet("Demo");
dataSet.readXmlSchemaFile("../data/Demo.xsd");
dataSet.readXmlFile("../data/Demo.xml");
args.report.regData("Demo", "Demo", dataSet);
}onBeforeRender— fires before the dashboard is built, so data can be attached at the last moment.dataSet.readXmlFile+args.report.regData— load a dataset and register it with the dashboard.
How it works. The dashboard receives its data right before rendering, so the template need not carry its own connections.