I would like to but divs around some of the tables in my reports to made them 'hidable'. I've done this in the past in web pages with some custom javascript. However, I can't seem to figure out how to get my custom javascript to work in my current report. Here is what I'm trying to do:
select 'dbr.javascript', 'function toggle() { var ele = document.getElementById("toggleText"); var text = document.getElementById("displayText"); if(ele.style.display == "block") {ele.style.display = "none";text.innerHTML = "show";}else {ele.style.display = "block";text.innerHTML = "hide";}}', 'onload';
select 'dbr.purehtml', 'show<div id="toggleText" class="left" style="display: none">'; SELECT * FROM datawarehouse.companies LIMIT 10; select 'dbr.purehtml', '</div>';
When I run the report and click on 'show', I get the javascript error: Uncaught ReferenceError: toggle is not defined
Is there a better way to do this?