Home
Analytics
Get element by ID
adilb
Hi All,
I want to get a reference to a report element via its ID. In javascript that would be done via
document.getElementById("myElemenentId").text="mytext";
Is there anything similar in birt script?
Regards,
Adil
Find more posts tagged with
Comments
hq4ever
<pre class='_prettyXprint _lang-auto _linenums:0'>reportContext.getDesignHandle().getElementByID(201)</pre>
<br />
Read all about this here <a class='bbc_url' href='
http://www.eclipse.org/birt/phoenix/deploy/reportScripting.php'>Report
Scripting</a>
adilb
Thanks for the hint. But I still have problems making it work
use the statement
reportContext.getDesignHandle().getElementByID(609).text = "my text"
but that didnt work. I suppose the element handle is obtained correctly but the text property is not set.
Any more thoughts on this?
Thanks,
Adil
bluish
Maybe you could try to wrap the id in double quotes. Let me know!
Rajesh kmr
in which element you are writing this statement and in which method..please explain
kclark
<blockquote class='ipsBlockquote' data-author="'adilb'" data-cid="52772" data-time="1251040935" data-date="23 August 2009 - 08:22 AM"><p>
Hi All,<br />
<br />
<br />
I want to get a reference to a report element via its ID. In javascript that would be done via <br />
<br />
<br />
document.getElementById("myElemenentId").text="mytext";<br />
<br />
<br />
Is there anything similar in birt script?<br />
<br />
<br />
Regards,<br />
<br />
<br />
Adil<br /></p></blockquote>
<br />
You can do this a few ways<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
reportContext.getDesignHandle().findElement("myElementId").text = "test"
</pre>
<br />
If you labeled it, if you know the ID number you can use the following<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
reportContext.getDesignHandle().getElementByID(74).text = "Test"
</pre>
<br />
Where 74 is the ID number
jain
Hi,
In my report I need to set the content in master page footer based on the element Id. I have three sections in my report and each section has table element and I must ensure that a section always starts on a new page (page break).
Also the master page footer content varies for each section, so how do I change the content for each section in master page footer?
section1(in page 1): Header(some logo)
Table
Footer ("some test for example: Test A")
section2(in page 2): Header(some logo)
Table
Footer ("some test for example: Test B")
section3(in page 3): Header(some logo)
Table
Footer ("some test for example: Test c")