cancel
Showing results for 
Search instead for 
Did you mean: 
Liliia_DevX
Sisense Team Member
Sisense Team Member

How to Hide a Download Button for a Particular Widget

This article explains how you can disable the 'Download' button with all its options on for a specific widget. The solution is a JavaScript code snippet that can be applied on a dashboard level. 

Screenshot 2023-07-11 at 17.06.52.png


How to Use the Script?

Firstly, you need to grab ids of the widgets you want to apply the solution. In order to do that, please open the widget in 'Edit mode' (pencil sign) and copy the id from the URL in the browser address bar:

Screenshot 2023-07-11 at 17.16.38.png


Secondly, the script works on the dashboard level, so to add it you need to click on the 3 dots menu on the dashboard and navigate to the 'Edit Script' option:

Screenshot 2023-07-11 at 17.11.34.png


Then paste the ids of the widgets to be affected by the script in the first row of code in []. If there are multiple widgets, separate the ids by commas. The example is ['64ad02333bb2dd002ab5fab8', '64a3c9cf366a9400329df727']. 

 

 

 

 

 

var widgetId = ['64ad02333bb2dd002ab5fab8'];

dashboard.on('beforewidgetmenu', (dashboard, items) => {
	
	if(widgetId.includes(items.widget.oid)){
		
		var downIndex;
		
		var found = items.items.some((item, index) => {
			downIndex = index; return item.id == "download";
		});

		if (!found) {
			return false;
		}
		items.items.splice(downIndex, 2);
	}
});

 

 

 

 

 

Once the script is adjusted with widget ids, please save it and refresh the dashboard page. As a result, there will not be a 'Download' button available for the specific widget:

Screenshot 2023-07-11 at 17.26.56.png

Feel free to use this code snippet as an example and enhance it further to achieve similar goals and share such solutions with us!

If you need to hide a specific option (like export to Excel), please refer to the example in the following article:

 How to Hide Export to Excel Option On a Pivot Table (Linux) 

Disclaimer: Please note, that this blog post contains one possible custom workaround solution for users with similar use cases. We cannot guarantee that the custom code solution described in this post will work in every scenario or with every Sisense software version. As such, we strongly advise users to test solutions in their own environment prior to deploying them to ensure that the solutions proffered function as desired in their environment. For the avoidance of doubt, the content of this blog post is provided to you “as-is” and without warranty of any kind, express, implied or otherwise, including without limitation any warranty of security and or fitness for a particular purpose. The workaround solution described in this post incorporates custom coding which is outside the Sisense product development environment and is therefore not covered by not covered by Sisense warranty and support services.

Rate this article:
Comments
karengonzalez
8 - Cloud Apps
8 - Cloud Apps

Hi, Liliia

Can this also be done on dashboard level, to hide the "Download" from the dashboard "Options" menu?

karengonzalez_0-1726703311326.png

Thank you,

ILLIA
Sisense Team Member
Sisense Team Member

@karengonzalez Hello
Please try this script: 

prism.on('beforemenu', (scope,args)=>{
	if(args.settings.name === 'dashboard'){
		let downloadIndex = args.settings.items.findIndex(i => i.id === 'download')
		args.settings.items.splice(downloadIndex, 2)
	}
})

Let me know how it goes.


Best regards,
Illia

Version history
Last update:
‎02-13-2024 12:58 PM
Updated by: