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 off.

I can't seem to find the option in menus. Is it possible to edit the script using JavaScript?

Thanks!

 

 

  • 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

  • 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();
    } 
    }

4 Replies

Replies have been turned off for this discussion
  • 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

    • frankmol's avatar
      frankmol
      Cloud Apps

      Hi Angelina,

      Thanks, this works perfectly for single filters, but when I add a dependent filter, the toggle button reappears. Is it possible to hide these toggle buttons as well?

      Thanks again for your help!

      Regards,

      Frank

      • 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();
        } 
        }
  • Is there a way to do this same sort of thing for the "Edit Filter" window that pops up? I want to disable the "Allow multiselect for lists" toggle, as well as the radio buttons except for the 2nd one where the user selects a filter value