How can I show and hide a Data item?

javier.latorre
edited February 11, 2022 in Analytics #1

Hello everyone!

I'm trying to show and hide a Data item, I followed the next steps:

  • I added a data item with the property Display: No Display, and I added a Bookmark = "rawmaterial"
  • I added a HTML Button with the following code in the onclick script: (I'm also hiding and showing some Charts)

this.onclick = function(event)
{
var bviewer = this.getViewer();
var bcontent= bviewer.getCurrentPageContent();

var yield=bcontent.getChartByBookmark("yield");
var rawMaterial=bcontent.getDataItemByBookmark("rawmaterial");

yield.show();
rawMaterial.show();
yield.setSize(450,1200);

var capacity=bcontent.getChartByBookmark("capacity");
capacity.hide();

var uptime=bcontent.getChartByBookmark("uptime");
uptime.hide();

capacity.submit(function(){
    uptime.submit(function(){
        yield.submit();
    }); 
});

}

  • When I run the report, I can show and hide the charts but no the data item, I get a error - TypeError: rawMaterial is null

Any idea of what I'm doing wrong?

Thanks