Forum Discussion

Tet's avatar
Tet
Cloud Apps
02-06-2024
Solved

export only the visible widgets to PDF using the Tabber plugin

I am building a dashboard using the Tabber plugin.

However, during the export process to pdf, all widgets are included, even those hidden by Tabber.

Is there a way to address this issue without relying on other plugins?

I am specifically looking for a script-based solution.

Thanks,

  • You can always refer to the tabbers 'active tab' hide list using something like:

    const tabberWidget = dashboard.widgets.$$widgets.find((w) => { return w.oid === 'TABBER_WIDGET_OID'}
    let currentlySelectedHideList = tabberWidget.tabs[tabberWidget.style.activeTab].hideWidgetIds
    
    // hide pdf based on this list.

     You could use this to adjust the DOM accordingly on click for widgets in hidelist and clear the rule for all other widgets...

    $('[widgetid=' + ev.widget.oid + ']').closest('.u-r').height(0)

    Let me know how you go?

    Thanks,

    Daniel

    RAPID BI

    [email protected]

    RAPID BI - Sisense Professional Services | Implementations | Custom Add-ons

5 Replies

Replies have been turned off for this discussion
  • You can always refer to the tabbers 'active tab' hide list using something like:

    const tabberWidget = dashboard.widgets.$$widgets.find((w) => { return w.oid === 'TABBER_WIDGET_OID'}
    let currentlySelectedHideList = tabberWidget.tabs[tabberWidget.style.activeTab].hideWidgetIds
    
    // hide pdf based on this list.

     You could use this to adjust the DOM accordingly on click for widgets in hidelist and clear the rule for all other widgets...

    $('[widgetid=' + ev.widget.oid + ']').closest('.u-r').height(0)

    Let me know how you go?

    Thanks,

    Daniel

    RAPID BI

    [email protected]

    RAPID BI - Sisense Professional Services | Implementations | Custom Add-ons

  • Hi Tet ,

    You should be able to use the following to hide widgets with oids.

    Solved: HIDE WIDGET WHEN EXPORTING TO PDF - Sisense Community

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

    You could integrate this  as part of your tabber to  hide widgets on the fly that are part of of your 'hideList'.

    Let me know how you go?

    Thanks,

    Daniel

    RAPID BI

    [email protected]

    RAPID BI - Sisense Professional Services | Implementations | Custom Add-ons

  • Hello Tet ,

    Did the solution offered by rapidbisupport  work for you? If so, please click the 'Accept as Solution' button so that other users with the same questions can find the answer faster. If not, please let us know so that we can continue to help.

    Thank you.

  • Tet's avatar
    Tet
    Cloud Apps

    rapidbisupport 
    Thank you for your answer and also apologies for the late reply.

    I have reviewed the post, but unfortunately, it does not fully align with my intended objective. It appears that I will need to manually assign the widget oids in the script. However, the widgets I wish to hide vary depending on the tab I select on the dashboard.

    Is there a way to achieve the following?
    - Establish separate "hide lists" for both Tab A and Tab B.
    - Whenever Tab A is selected, the widgets listed in "hide list A" would be hidden when exporting to pdf.