Eclipse BIRT and JavaScript in reports

With Firefox 5, Firefox 6, Chrome 13, Chrome 14 and Chrome 15 all JavaScript embedded in a Eclipse BIRT report don’t work anymore. Nothing is executed 😦

After some googling I find out that the problem is really new and reported in the BIRT issue tracker: https://bugs.eclipse.org/bugs/show_bug.cgi?id=351217.

After half a day of struggling in BIRT viewer code I found the problem!

The file webcontent/birt/ajax/ui/report/AbstractReportComponent.js contains the code

 //  Internet Explorer has a funky execScript method that makes this easy
 if ( window.execScript )
     window.execScript( scripts[i].innerHTML );

this is not executed by new browsers and therefore all javascript is ignored. I’ve changed this block of code with

//  Internet Explorer has a funky execScript method that makes this easy
if ( window.execScript ){
    window.execScript( scripts[i].innerHTML );
}else {
    with (window) {
        window.eval(scripts[i].innerHTML);
    }
 }

and now it works again!

2 thoughts on “Eclipse BIRT and JavaScript in reports

  1. Thank you so much for finding this! I’ve been wanting to put JS in BIRT for quite some time, but didn’t want to without Firefox support. This will open up so many more possibilities for my reports!

    • You are welcome 🙂 Please let me know if you find out some more problems. BIRT is a very good framework but sometimes needs some fixes.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s