Knowledge Base Article

How to create a custom button in your Pivot table [Linux]

This article will teach you how to create a custom button in the top of your Pivot table to trigger any events or codes of your preference. Applicable for Sisense on-prem and cloud, all versions. Tested on version L2025.4.

Step-by-step Guide

1. Navigate to your preferred Pivot Table widget and open the script editing screen.

2. Next, enter the following script:

widget.on("ready", () => {
	let widgetElement = document.querySelector('[widgetid="' + widget.oid + '"]');
  	if (widgetElement) {
		let widgetContainer = widgetElement.querySelector('.widget-body');
		if (widgetContainer) {
		  // Don’t add the button multiple times
		  if (!widgetContainer.querySelector('.highlight-top-btn')) {
			const button = document.createElement('button');
			button.textContent = "Refresh Widget"; // Display name inside the button
			button.className = "highlight-top-btn";
			button.style.display = "block";
			button.style.margin = "5px 0 0 10px";
			button.style.background = "#94F5F0";
			button.style.border = "none";
			button.style.borderRadius = "4px";
			button.style.visibility = "visible";
			button.style.cursor = "pointer";
			  
			//Use this as a workaround to readjust the widget height in case you have too many buttons, or if they are big enough to start cutting the end of the widget.
			//It is not guaranteed this will work in all scenarios.
			//widgetElement.style.height = "auto";
			  
			button.onclick = function() {
				//Any functions, actions, or custom code you want to call when the button is clicked, in this example we will call a simple widget refresh event
				widget.refresh();
			};
			widgetContainer.insertBefore(button, widgetContainer.firstChild);
		  }
		}
	 }
});

3. You should see a similar result, and when you click the button, the action you set in the onclick function will be performed. In our example, this will simply refresh the widget.

Conclusion

Using and adapting this script, you can create custom buttons and add them to the top of your Pivot Table Widgets, allowing you to perform your preferred actions with ease.

Disclaimer: This post outlines a potential custom workaround for a specific use case or provides instructions regarding a specific task. The solution may not work in all scenarios or Sisense versions, so we strongly recommend testing it in your environment before deployment. If you need further assistance with this, please let us know.

Published 11-28-2025
No CommentsBe the first to comment