现需要点击保存或另存为会调用事件,用了onAfterSave方法,并未看到控制台输出,具体代码如下
let designerOptions = GrapeCity.ActiveReports.WebDesigner.createDesignerOptions();
designerOptions.openButton.visible = true;
designerOptions.saveButton.visible = true;
designerOptions.saveAsButton.visible = true;
designerOptions.openViewer = function (options) {
if (viewer) {
viewer.openReport(options.reportInfo.id);
return;
}
viewer = GrapeCity.ActiveReports.JSViewer.create({
locale: 'zh',
element: '#' + options.element,
reportService: {
url: 'api/reporting',
onRequest: function (init) {
init.headers.Authorization = 'token';
}
},
reportID: options.reportInfo.id,
settings: {
zoomType: 'FitPage'
},
});
};
designerOptions.language = "zh"
designerOptions.documentApiHandlers.onAfterSave = () => {
console.log("创建了")
}
GrapeCity.ActiveReports.WebDesigner.renderApplication("ar-web-designer").then((api) => {
var reportContent = Templates;
api.settings.preview = {
canPreview: true,
openViewer: (options) => {
if (viewer) {
viewer.openReport(options.documentInfo.id);
return;
}
viewer = GrapeCity.ActiveReports.JSViewer.create({
element: '#' + options.element,
renderFormat: 'svg',
reportService: {
url: 'api/reporting',
},
reportID: options.documentInfo.id,
settings: {
zoomType: 'FitPage',
},
});
}
}
api.documents.openById(type + '/' + type + '_' + time + '.rdlx', { platform: 'rdlx', type: 'report', subType: 'cpl' }, 'NewReport', reportContent).then((rep) => {
});
})
|