1

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.

UlrichWuenstel
  • 460
  • 2
  • 10

1 Answers1

2

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

Sergey Ryskal
  • 388
  • 1
  • 9
  • I put this into the ic3report-local.js (in 5.1.7 and 5.2.0) and nothing happened. I also tried to exchange "viz.EventType" for "vizEventType" and "viz.event" (I found them here: http://stackoverflow.com/questions/28608244/is-it-possible-to-re-use-schema-specific-reports-on-different-schemas-in-iccube and http://stackoverflow.com/questions/34812708/iccube-set-filter-selection-from-custom-widget-js/34814336). Unfortunately still nothing happened. Are those viz packages open source, so that I can see somewhere, what events exist? searching for "viz onReportRendered" didn't give me a single page. – UlrichWuenstel Aug 19 '16 at 08:43
  • Updated for usage in ic3reporting-local, but if you have access to an integration html, then better use 1st part of answer – Sergey Ryskal Aug 22 '16 at 07:37
  • The code for the ic3report-local.js works very well. As for the other piece of code I have no clue, where to put it. You write integration html, but I don't know, what that is. I tried the ic3report.html, but that didn't work. Maybe I put it in the wrong place there... – UlrichWuenstel Aug 23 '16 at 10:19