Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
HeaderScriptHelper in BIRT 4.3
CaptainBob
<p>johnw submitted an article titled "Modified BIRT HTML Emitter" in July 2013:</p><p> </p><p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/devshare/_/designing-birt-reports/1490-modified-birt-html-emitter'>http://developer.actuate.com/community/devshare/_/designing-birt-reports/1490-modified-birt-html-emitter</a></p><p> </p><p>The
modified emitter includes a helper function to modify the html header:</p><p> </p><p><span>HeaderScriptHelper</span><span>.</span><span>AddHeaderTag</span><span>(</span><span>reportContext</span><span>,</span><span> </span><span>" "</span><span>);</span></p><p> </p><p><span>This is compatible with BIRT 3.7</span></p><p> </p><p><span>Does such a function exist for BIRT 4.3?</span></p><p><span>If not, how can one add the function to the BIRT 4.3 HTML Emitter?</span></p><p> </p><p><span>Thanks</span></p><p><span>Philip</span></p><p> </p>
Find more posts tagged with
Comments
kclark
<p>What are you trying to do with the header tag? In 4.3.x you can use head.js to include libraries, otherwise there is no function to change the contents of <head> that I'm aware of.</p>
CaptainBob
<p>I have developed a BIRT report with an embedded map using the open-source Leaflet API. This requires a reference to the external Leaflet.js file in the header tag. The map-report is successfully generated when I use the HeaderScriptHelper function developed for BIRT 3.7.x by johnw in July 2013.</p><p> </p><p>In 4.3.x, I have included a local copy of the leaflet.js as a resource, but BIRT issues an index range error when I render the report as html. I can use the external Leaflet CSS by specifying the external css URI, but I cannot use the external Leaflet.js library because BIRT only allows me to select a js file from the Shared Resource folder.</p><p> </p><p>Is it possible to use an external js library file in 4.3.x?</p>
Tubal
<p>If you can't get it to work with the head.js script in the report, I've had success accessing external .js files by putting them in an html text element somewhere in the report. As long as your output is HTML, it should work.</p><p> </p><p>
donino
<p>Hi,</p><p> </p><p>yes from v4.3 there is a specific feature handling this. There is now a "clientScripts" event (in the same dropdown list as "Initialize, "beforeFactory", etc.). Here we can add a js library and a callback function, for example:</p><pre class="_prettyXprint">head.js("http://d3js.org/d3.v3.min.js",function(){alert ("D3 library is loaded")});</pre><p>This will actually add D3 library to the header of the page, and invoke the callback once it is ready. Then, in a text HTML element of the report we can write stuff such:</p><pre class="_prettyXprint"><script> head.ready( //do stuff with JS libraries and <value-of> data bindings }</script></pre>
CaptainBob
<p>Thanks for the information regarding the "clientScripts" event.</p><p>The Leaflet js library is successfully added to the page header and the callback invoked using the head.js() as in the example.</p><p>Unfortunately, the call to a function in the Leaflet library using head.ready() does not work.</p><p> </p><p>However, as suggested by Tubal, I have successfully accessed the Leaflet library by putting the address in an html text element in my report. Thanks Tubal</p>