Forum Discussion

rafaelderas's avatar
rafaelderas
Cloud Apps
10-17-2023

Tabber plug-in execute OnClick event on dashboard load

I have found this post that shows how to select a default tabber option programatically:

https://community.sisense.com/t5/build-analytics/default-tabber-selection/m-p/2345

However, this manually displays and hides whatever widget you want and highlights the corresponding option on a tabber.

I have quite a complex dashboard where I'm hiding and showing lots of widgets and using two tabbers to organize, so I think it might be easier if there is a way to call the onclick event for one of the tabber options to have the tabber display or hide widgets when loading. Is there a way to achieve that?

1 Reply

Replies have been turned off for this discussion
  • Hi rafaelderas ,

    You can set any tab to be active when the dashboard loads with the following script. This script highlight the tabber option as well as active it:

    let tabName = 'Tab3';
    
    widget.style.activeTab = widget.tabs.findIndex(el=>el.title == tabName);

    The complete script will looks like this:

    widget.on('render',function(w, e) {
    	e.prefixText = '';
    	e.suffixText = '';
    	e.selectedColor = '#86b817'; /*The color of the chosen title*/
    	e.fontColor = '#cccccc'; /*The color of the unchosen titles*/
    	e.elementWidth = '103%';
    	e.descColor = '#a5a5a5';
    	e.parentMarginLeft = '-15px';
    	e.height = 32; /* affects the tabber widget default high*/
    });
    
    widget.tabs = [
    	{
    		title: "Tab1", 
    		displayWidgetIds : ["6568134f2968560034f519b1"],
    		hideWidgetIds : ["64df5b4ab729680033167174", "656961412968560034f51a7e", "65673d042968560034f5195a"]
    	},
    	{
    		title: "Tab2", 
    		displayWidgetIds : ["64df5b4ab729680033167174", "656961412968560034f51a7e"],
    		hideWidgetIds : ["6568134f2968560034f519b1", "65673d042968560034f5195a"]
    	},
    	{
    		title: "Tab3", 
    		displayWidgetIds : ["65673d042968560034f5195a"],
    		hideWidgetIds : ["6568134f2968560034f519b1", "64df5b4ab729680033167174", "656961412968560034f51a7e"]
    	}
    ];
    
    let tabName = 'Tab3'
    
    widget.style.activeTab = widget.tabs.findIndex(el=>el.title == tabName)

    Feel free to reach out if you have further questions, we're always happy to help 🙂
    [email protected] 
    Paldi Solutions