I use react. for add stimulsoft reports.js, first add necessary link to css and javascript files in my Index.html file :
<link href="Css/stimulsoft.viewer.office2013.whiteblue.css" rel="stylesheet" />
<script src="Scripts/stimulsoft.reports.js"></script>
<script src="Scripts/stimulsoft.reports.maps.js"></script>
<script src="Scripts/stimulsoft.viewer.js"></script>
After that i create a Component with this code :
import React from 'react';
class Viewer extends React.Component {
render() {
return <div id="viewerContent"></div>;
}
componentWillMount() {
var report = new window.Stimulsoft.Report.StiReport();
//create error
report.loadFile("MyReportFile.mrt");
var options = new window.Stimulsoft.Viewer.StiViewerOptions();
this.viewer = new window.Stimulsoft.Viewer.StiViewer(options, "StiViewer", false);
this.viewer.report = report;
}
componentDidMount() {
this.viewer.renderHtml("viewerContent");
}
}
export default Viewer;
and loadFile method caused below error in console :
stimulsoft.reports.js:73 [Deprecation] Synchronous XMLHttpRequest on the main thread is
deprecated because of its detrimental effects to the end user's experience. For more help, check
https://xhr.spec.whatwg.org/.
Unexpected token < in JSON at position 0
Uncaught TypeError: Cannot read property 'isDashboard' of undefined
at stimulsoft.viewer.js:11
How to fix this error?