When I try to change report when another one is loaded, the data from data source is not setted on the report template and there is thrown exception:
Here is the pseudocode:Cannot read properties of null (reading 'pageNumbers')
Code: Select all
window["viewer"] = new Stimulsoft.Viewer.StiViewer(null, "StiViewer", false);
...
const reportContent = getReportForSelectedItem();
const report = new Stimulsoft.Report.StiReport();
report.load(reportContent);
//not working
window["viewer"].report = report;
However if I will create a new instance of report viewer, the problem is solved:
Code: Select all
window["viewer"] = new Stimulsoft.Viewer.StiViewer(null, "StiViewer", false);
...
const reportContent = getReportForSelectedItem();
const report = new Stimulsoft.Report.StiReport();
report.load(reportContent);
//working
window["viewer"] = new Stimulsoft.Viewer.StiViewer(null, "StiViewer", false);
window["viewer"].report = report;
Is there a possibility to refresh existing viewer instance? I would like to avoid create new instance of the viewer.Cannot read properties of undefined (reading 'postAction')