Forum Discussion

frankmol's avatar
frankmol
Cloud Apps
05-15-2023
Solved

How do i disable toggle switch button in filterpane?

Hi, For my dashboard, I would like to disable or delete the toggle switch buttons in the filter pane (shown in the picture), so the users of the dashboard do not have the option to turn them on or o...
  • Angelina_QBeeQ's avatar
    05-16-2023

    Hi frankmol,

    You can try the next script to hide toggles:

    var filterText = ['Country','Segment']; // add here the names of the filters
    
    dashboard.on('refreshstart', (el, args) => {
    hideFilterToggle(el, args);
    });
    
    dashboard.on('widgetready', (el, args) => {
    hideFilterToggle(el, args);
    });
    
    var hideFilterToggle = (el, args) => {
     for (index = 0; index < filterText.length; index++) { 
     var tag = $('span.ew-i-caption:contains(' + filterText[index] + ')', $('div.ew-panel'));
     $('label.custom-togglebtn__label', tag.parent().parent().parent().parent()).remove();
    } 
    }

    Hope this helps you.

    Always here to help,

    Angelina from QBeeQ
    [email protected]
    QBeeQ  - Gold Implementation and Development Partner

  • Angelina_QBeeQ's avatar
    Angelina_QBeeQ
    05-16-2023

    You can hide all toggles from the dashboard with this script:

    dashboard.on('refreshstart', (el, args) => {
    hideFilterToggle(el, args);
    });
    
    dashboard.on('widgetready', (el, args) => {
    hideFilterToggle(el, args);
    });
    
    var hideFilterToggle = (el, args) => {
     for (index = 0; index < args.dashboard.filters.$$items.length; index++) { 
     $('label.custom-togglebtn__label').remove();
    } 
    }