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)
Unable to get property 'style' of undefined or null reference
Arif shah
<p>Hi,</p><p> </p><p>I have created the following javascript function to hide or show charts and then calling it from a text item.</p><pre class="_prettyXprint">function showhidetab(showflag,bookmark, heightval, tab){ if (tab == 'overview') { document.getElementById('overgrid').style.visibility="visible"; document.getElementById('overgrid').style.display = "block" document.getElementById('overgrid').style.height= '6in'; } else { document.getElementById('overgrid').style.visibility="hidden"; document.getElementById('overgrid').style.display = "none" document.getElementById('overgrid').style.height='0px'; } }</pre><p>This function is working when I run it as html or in preview. However, When I deploy the report on birtviewer view it on IE/safari etc, I get the following error</p><pre class="_prettyXprint">SCRIPT5007: Unable to get property 'style' of undefined or null reference</pre><p>Can someone please tell me why is the report behaving differently when run through browsers and on Birtviewer/apache</p><p> </p><p>Regards</p><p>Syed</p>
Find more posts tagged with
Comments
pricher
<p>Hi,</p><p> </p><p>I assume you are using the BIRT Viewer Toolkit when you view your reports. The BIRT Viewer Toolkit will add a prefix to the bookmarks you have defined in your BIRT report to help identify in which viewer your HTML component is running. This is because with the BIRT Viewer Toolkit, you can use JSAPI to embed BIRT content in a web page and you can instantiate more than one BIRT viewer on a single web page.</p><p> </p><p>Assuming that you are simply using the BIRT Viewer Toolkit to run and display a report, you can fix your issue by prefixing the element ID with 'js3_' in your JavaScript. For example, [font="'courier new', courier, monospace;"]<span>document[/font]<span>.</span><span>getElementById</span><span>(</span><span>'<strong>overgrid</strong>'</span><span>).</span><span>style</span><span>.</span><span>visibility</span><span>=</span><span>"visible"</span></span><span>; will become [font="'courier new', courier, monospace;"]<span>document[/font]<span>.</span><span>getElementById</span><span>(</span><span>'<strong>js3_overgrid</strong>'</span><span>).</span><span>style</span><span>.</span><span>visibility</span><span>=</span><span>"visible"</span></span><span>;</span></span></p><p> </p><p>Hope this helps,</p><p> </p><p>P.</p>
Arif shah
<p>Many thanks for your reply. Can you please tell me that If I had to debug/inspect this in IE development tool, how can I check the elements and their ids? Should I be checking the html elements?</p>
pricher
<p>Hi,</p><p> </p><p>I don't know much about IE's development tools, but in Chrome, I can inspect an element and find its ID. This is how you will see that in the BIRT Viewer Toolkit, components that you have bookmarked have a prefixed of "js3_".</p><p> </p><p>Hope this helps,</p><p> </p><p>P.</p>
Arif shah
<p>HI,</p><p> </p><p>It seems like the charts have rendered on second or third page and those elements can't be reached from javascript called on first page?</p><p> </p><p>Is there anyway to call the elements of second page from javascript of first page?</p><p> </p><p>Syed</p>
pricher
<p>Hi Syed,</p><p> </p><p>the only way I can think of doing this is by having the control that hides or show your charts in the header of the master page. In other words, in order for your script to find the chart, the chart and the script must reside on the same page.</p>
Arif shah
<p>How can I enforce all the charts to stay on the same page?</p>
pricher
<p>If you are using the BIRT viewer, the only way to have your charts on the same page is to make the charts smaller or the page bigger... Otherwise, view you report as an HTML document.</p>