How to refresh viewer
Posted: Wed Oct 23, 2024 11:28 am
Hello, how can I refresh the viewer object after changing the report? I am trying to implement the funcionality for changing reports with dropdown.
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:
However if I will create a new instance of report viewer, the problem is solved:
I tried to use 'window["viewer"].refreshViewer()' function, but it throws:
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')