onCreate() event on Master page

Scarlett
edited February 11, 2022 in Analytics #1
So I have a grid element in my report that references a function coming from a *.js file. This works just fine. But on the Master Page I also need to manipulate the logo which I intend to do on the onCreate event. However, when I add code to this event for the logo, my table element cannot access the function in the *.js file. I've also tried moving the function from the .js file to the initialize event of the report. Still no luck.

Can somebody please help me with this issue?

Comments

  • kclark
    kclark E
    edited December 31, 1969 #2
    What BIRT version are you using? I wrote a simple JS file like this<br />
    <br />
    <pre class='_prettyXprint _lang-auto _linenums:0'>
    function test() {
    return (1+3);
    }
    </pre>
    <br />
    Then I added that JS file to the resources and then included the file from properties > resources > JavaScript Files.<br />
    <br />
    Then from the onCreate() of a label in my masterpage headers<br />
    <br />
    <pre class='_prettyXprint _lang-auto _linenums:0'>
    var testVar = test();
    this.text = testVar;
    </pre>
    <br />
    Can you recreate this with the sample DB and post it?
    Warning No formatter is installed for the format ipb
  • Scarlett
    edited December 31, 1969 #3
    Hi kclark,

    I did some investigating and I think I've narrowed it down. I have java (not JS) in my onCreate() event with import statements et al. (I'm not an expert on Java so pardon me if this sounds incorrect). My JS file is just that, javascript. When I remove the import statements, the code in my onCreate() event fails (obviously) but now the methods from the JS file work correctly. What am I missing here?

    -Scarlett
  • kclark
    kclark E
    edited December 31, 1969 #4
    Can you post the rptdesign? What package are you importing in the onCreate()?
    Warning No formatter is installed for the format ipb