问题
It is possible to place javascript code into ic3report-local.js to be used in every report. A function in there can be called in the Javascript of a report.
But is it possible, to have a function in there being fired at a specific event (for example after build) in every report automatically? Or do I have to call it in every report?
We would like to add a glossary to every report after build.
回答1:
You can try attaching to global reporting events:
var reporting = ic3.startReport(options);
reporting.bind(viz.EventType.onReportRendered,
function(){
alert("report rendered")
}
);
Using this functionality in ic3reporting-local.js is available but could break loading sequence, because you need to wrap one of the start methods with your own implementation(since we don't have an reporting instance while this file is loading). Please, ensure that you're using the latest available version before adding the followng code to global javascript file.
var originalStart = ic3.startReport;
ic3.startReport = function(options) {
var reporting = originalStart(options);
reporting.bind(viz.EventType.onReportRendered,
function(){
alert("report rendered")
});
return reporting;
}
If anything goes wrong after applying this code, you can edit ic3reporting-local.js from icCube IDE at Docs -> applocal -> ic3reporting-local.js
来源:https://stackoverflow.com/questions/39000857/iccube-javascript-function-applied-to-all-reports