JavaScript resource files [message #938529] |
Tue, 09 October 2012 20:16  |
Eclipse User |
|
|
|
Hi,
Whenever possible I create my JavaScript functions used by reports in external files and add them to the report via the resources ui.
I have just completed a report where I added row hover highlights, using the following functions in a text/html element placed on the report, above the first table:
<script>
// add highlighted background on hover
function hoverShadeOn(bmark, rgb) {
var currElement;
currElement = document.getElementById(bmark);
currElement.style.backgroundColor = "RGB(" + rgb + ")";
}
// remove highlighted background on hover
function hoverShadeOff(bmark){
var currElement;
currElement = document.getElementById(bmark);
currElement.style.backgroundColor = "transparent";
}
</script>
I set the first element of each row to highlight the rest of the row when hovered, using a text/html element as follows:
<a href = ""
onmouseover="hoverShadeOn('ProductLine_<VALUE-OF>row["productCode"]</VALUE-OF>','221,221,221');"
onmouseout="hoverShadeOff('ProductLine_<VALUE-OF>row["productCode"]</VALUE-OF>');"
>
<VALUE-OF>row["productLine"]</VALUE-OF>
</a>
I set it's bookmarks appropriately and it works as expected.
I decided to externalize the hoverShadeOn and hoverShadeOff functions as I will use them in other reports. I copied everything except the script tags and comments to a .js file (hoverShading.js) as follows:
function hoverShadeOn(bmark, rgb) {
var currElement;
currElement = document.getElementById(bmark);
currElement.style.backgroundColor = "RGB(" + rgb + ")";
}
function hoverShadeOff(bmark){
var currElement;
currElement = document.getElementById(bmark);
currElement.style.backgroundColor = "transparent";
}
I then removed the text/html element at the top of my report which held the functions. My hover action stops working.
As I have stated, I use external js functions often but in BIRT functions such as initialize or dataset beforeOpen.
Text elements must work differently? I considered needing to add the script tag to my function call as follows but it does not work.
onmouseover="<script>hoverShadeOn('ProductLine_<VALUE-OF>row["productCode"]</VALUE-OF>','221,221,221');</script>"
What am I missing here?
Thanks,
Dave
|
|
|
|
|
Re: JavaScript resource files [message #968106 is a reply to message #968059] |
Fri, 02 November 2012 03:44  |
Eclipse User |
|
|
|
On a slightly different note - Do you know where I can subscribe to get (or at least manually download) a set of release notes, each time a new version of BIRT designer or viewer is released? I can find the general 'New and Notable Features within BIRT X.X' version notes but I am after more granular build notes.
The reason I ask is that Tomcat 7.0.32 is causing the (v 4.0.2) viewer's jsp comments to error (see http://mail-archives.apache.org/mod_mbox/tomcat-dev/201210.mbox/%3Cbug-53986-78@https.issues.apache.org/bugzilla/%3E).
I wanted to see if the latest viewer version has fixed this but could not find the build release notes on eclipse website and have had to download the new viewer and check files to see that comment tags have not been changed. This may be a bug with Tomcat which they will fix but some individual build release notes would be handy.
Thanks again for your assistance.
David
|
|
|
Powered by
FUDForum. Page generated in 0.50414 seconds