Forum Discussion

cartercjb's avatar
12-21-2021
Solved

HIDE WIDGET WHEN EXPORTING TO PDF

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

  • 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)
    	}
    });

     

     

7 Replies

Replies have been turned off for this discussion
  • harikm007's avatar
    harikm007
    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)
    	}
    });

     

     

    • Ophir_Buchman's avatar
      Ophir_Buchman
      Data Integration

      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)
      	}
      });
      • Wantti's avatar
        Wantti
        Cloud Apps

        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

  • Ophir_Buchman's avatar
    Ophir_Buchman
    Data Integration

    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

    • cartercjb's avatar
      cartercjb
      ETL

      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. 

       

  • Ophir_Buchman's avatar
    Ophir_Buchman
    Data Integration

    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

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

    THANKS!

    -CARTER