<div id="designer-id" style="width: 100%; height: 100%;"></div>
<script>
var keyValue = "2c20ca72-08aa-4b9b-84a8-6c6a85fee937";
var designerOptions = GrapeCity.ActiveReports.WebDesigner.createDesignerOptions();
designerOptions.server.url = 'api';
designerOptions.reportInfo = '2c20ca72-08aa-4b9b-84a8-6c6a85fee937.rdlx' ? { id: '2c20ca72-08aa-4b9b-84a8-6c6a85fee937.rdlx' } : null;
designerOptions.openButton.visible = true;
designerOptions.saveButton.visible = true;
designerOptions.saveAsButton.visible = true;
// Used in About dialog and File View Help tab.
designerOptions.documentation.home = 'https://www.grapecity.com/activereports/docs/v15/online-webdesigner/overview.html';
// Used in notifications about report items transformation.
designerOptions.documentation.reportItemsTransformation = 'https://www.grapecity.com/activereports/docs/v14/online-webdesigner/supportedcontrols.html';
designerOptions.reportItemsFeatures.table.autoFillFooter = true;
var viewer = null;
designerOptions.openViewer = function (options) {
if (viewer) {
viewer.openReport(options.reportInfo.id);
return;
}
viewer = GrapeCity.ActiveReports.JSViewer.create({
locale: options.locale,
element: '#' + options.element,
reportService: {
url: 'api/reporting',
},
reportID: options.reportInfo.id,
settings: {
zoomType: 'FitPage'
},
});
};
designerOptions.dataTab.dataSets.canModify = true;
designerOptions.dataTab.dataSources.canModify = true;
designerOptions.onSaveAs = function (options) { console.log(options); }
designerOptions.onReportSave = function (options) { console.log(options);}
designerOptions.onReportSaved = function (options) {
console.log(options);
console.log(options.id);
console.log(options.name);
///报表保存后重新加载上级页面报表
for (var i = 0; i < top.frames.length; i++) {
if (top.frames[i]._parentId == keyValue) {
top.frames[i].loadReport();
}
}
alert('保存成功');
};
console.log(designerOptions);
GrapeCity.ActiveReports.WebDesigner.renderApplication("designer-id", designerOptions);
</script>
</body>
</html>
我们程序这样写的,好像和您那种不一样,还有,我可以在这给报表添加数据源吗? |