Registering a Data from Code
Наши примеры проектов и шаблоны отчётов помогут Вам разобраться в основах работы с нашими продуктами.Data can be registered for the report from code just before it renders, using the onBeforeRender event that runs on the client.
The event name is set in PHP and the handler runs in the browser, where it builds a dataset and registers it with
На скриншоте ниже Вы можете увидеть результат выполнения данного кода:

$report = new StiReport();
$report->onBeforeRender = 'onBeforeRender';
$viewer->process();
$report->loadFile('../reports/SimpleList.mrt');
$viewer->report = $report;function onBeforeRender(args) {
let dataSet = new Stimulsoft.System.Data.DataSet("Demo");
dataSet.readJson(jsonData);
args.report.dictionary.databases.clear();
args.report.regData("Demo", "Demo", dataSet);
}onBeforeRender = 'onBeforeRender'— names the JavaScript function that runs in the browser just before the report renders.new Stimulsoft.System.Data.DataSet / readJson— builds a dataset on the client and fills it from JSON.dictionary.databases.clear()— removes the design-time data connections so only your data is used.regData("Demo", "Demo", dataSet)— registers the dataset with the report under a data source name.
The event name is set in PHP and the handler runs in the browser, where it builds a dataset and registers it with
regData before the report is rendered.На скриншоте ниже Вы можете увидеть результат выполнения данного кода:
