Registering a Data from Code when Exporting a Dashboard on the Server-Side
Our sample projects and report templates can help you learn the basics of working with our products.When exporting on the server, data can be registered in the
Register data, then export.
How it works. The data-registration script runs inside the Node.js engine, so a headless export can bind data exactly as the browser would.
onBeforeRender event — supplied as client JavaScript run by the Node.js engine.Register data, then export.
$report = new StiReport();
$report->engine = StiEngineType::ServerNodeJS;
$report->onBeforeRender = '
let dataSet = new Stimulsoft.System.Data.DataSet("Demo");
dataSet.readXmlSchemaFile("data/Demo.xsd");
dataSet.readXmlFile("data/Demo.xml");
args.report.dictionary.databases.clear();
args.report.regData("Demo", "Demo", dataSet);
';
$report->process();
$report->loadFile('reports/ProductStats.mrt', true);
$result = $report->exportDocument(StiExportFormat::Html);onBeforeRender— assigned a JavaScript string that the Node.js engine runs before building the dashboard.args.report.regData(...)— register the dataset so the server-side export renders with it.
How it works. The data-registration script runs inside the Node.js engine, so a headless export can bind data exactly as the browser would.