cancel
Showing results for 
Search instead for 
Did you mean: 

HIDE WIDGET WHEN EXPORTING TO PDF

cartercjb
10 - ETL
10 - ETL

Is anyone aware of a script/method other than plugins for excluding a specific widget when exporting to PDF? I want to exclude a Tabber widget when exporting to pdf. 

Thanks!

-Carter

1 ACCEPTED SOLUTION

harikm007
13 - Data Warehouse
13 - Data Warehouse

Hi @cartercjb ,

You can hide a widget from pdf by using below script. I tested it in a linux based system. Add this script in your dashboard script and update the variable widgetid.

 

dashboard.on('widgetready', function (se, ev) {
	
	widgetid = '3aecd1801eafb16865d4c87lre'
	
	if(ev.widget.oid == widgetid)
	{
		$('[widgetid=' + widgetid + ']').closest('.u-r').height(0)
	}
});

 

 

View solution in original post

7 REPLIES 7

Ophir_Buchman
Sisense Team Member
Sisense Team Member

Hi @cartercjb ,

Does the use case refer to exporting via the "Export to PDF" button or to the PDF document that is sent as part of the email attachment?

Ophir

Hi @Ophir_Buchman - 

This use case is for the normal Export to PDF button. The space highlighted in yellow is the Tabber widget I am trying to exclude from the export. 

Snag_1611008.png

 

Ophir_Buchman
Sisense Team Member
Sisense Team Member

Hi @cartercjb,

I know you were asking for a non-plugin solution, but we have a plugin that does just this (See https://www.sisense.com/marketplace/hide-widget-row-on-pdf/)

Another way to go is to build the "tabber" into an "Accordion" (which you most likely are already using) which is not opened by default. Exporting the PDF will export it without the data in the accordion.

Any other solution requires integration into the "Export PDF" code - Which is internal

harikm007
13 - Data Warehouse
13 - Data Warehouse

Hi @cartercjb ,

You can hide a widget from pdf by using below script. I tested it in a linux based system. Add this script in your dashboard script and update the variable widgetid.

 

dashboard.on('widgetready', function (se, ev) {
	
	widgetid = '3aecd1801eafb16865d4c87lre'
	
	if(ev.widget.oid == widgetid)
	{
		$('[widgetid=' + widgetid + ']').closest('.u-r').height(0)
	}
});

 

 

Great solution @harikm007 !!!

Please just note 2 things:

  1. This code hides the entire widget row - So you should place this widget on its own row
  2. This script doesn't effect PDFs sent as email attachments

Also, here is another version of this script offering you to provide an ID list (rather than a single ID):

widgetsToHide = ['614c7929feba1f08d4e71dd4','6197738df7f55b16c058415f']

dashboard.on('widgetready', function (se, ev) {
	
	if(widgetsToHide.includes(ev.widget.oid))
	{
		$('[widgetid=' + ev.widget.oid + ']').closest('.u-r').height(0)
	}
});

Hi Ophir,

your script was very helpful. Thank you!

Is there also a way how to manipulate single widgets in their size and look?

My issue is that I have some widgets that are too large and overlap to the next page, or when using the portrait mode, the columns of my pivot tables do not show anymore. 
And the pivot tables are not formatted like they are on the dashboard.

your help is greatly appreciated

Antti

cartercjb
10 - ETL
10 - ETL

YOU, MY FRIEND, @harikm007  are a magic man. I tried to give you Kudos x 100000 but it would not let me.

THANKS!

-CARTER