Reset to Default Filters When Loading Dashboard

Comments

7 comments

  • Avatar
    Ronen Avidor

    Another way to change the size and image of the reset filter button is to access the class of the button directly as follow during the Dashboard Initialized event:

     

    dashboard.on('initialized', function(sender, ev){ //Adds filter reset button to the toolbar

                    $('.filters-global-header .filters-reset-button').css('width','50px');

                    $('.filters-global-header .filters-reset-button').css('height','50px');

                    $('.filters-global-header .filters-reset-button').css('background-image', 'url(../client/resources/ux-controls/images/refresh_48.png)');

    })

    0
    Comment actions Permalink
  • Avatar
    Tracey Black

    I added the script and nothing changed. Can someone please attach a screenshot of what the reset filter button looks like?

    0
    Comment actions Permalink
  • Avatar
    Charles Jovanovich

    The above script will cause PDF export to fail. 

    To fix the PDF export change the refresh value in the else statement to False:

    else{//Only refresh dashboard on the last filter d.filters.update(filter,{ save:true, refresh:false, unionIfSameDimensionAndSameType:true });
    0
    Comment actions Permalink
  • Avatar
    Antti Wolk

    Hi,

    is there a way to build a "reset button".

    To have the same functionality of resetting all filters when clicking a button instead of reloading the page?

     

    thanks

    Antti

    0
    Comment actions Permalink
  • Avatar
    Ronen Avidor

    Hi Antti,

    You can use this article ,https://support.sisense.com/hc/en-us/community/posts/360015945013-Adding-Custom-Menu-Items-to-Dashboards , to add dashboard menu item, and just insert the reset filter reset code instead of the sample.

    Best,

    Ronen

    1
    Comment actions Permalink
  • Avatar
    Elliott Herz

    Here is a dashboard script that just resets all filters (except for locked filters) to include all during dashboard initialization. Tested with dependent filters + locked filters + background filters.

     

    dashboard.on('initialized', (el, args) => {
    args.dashboard.filters.$$items.forEach((itemFilter) => {
    if(itemFilter.locked === undefined || itemFilter.locked === false) { //Check if the filter is locked, so we don't reset it.
    if(itemFilter.levels !== undefined) { //Check dependent filters
    itemFilter.levels.forEach((depFilter) => {
    depFilter.filter.members = undefined;
    depFilter.filter.all = true;
    depFilter.filter.explicit = false;
    });
    }

    if(itemFilter.jaql !== undefined) { //reset normal filters
    itemFilter.jaql.filter.members = undefined;
    itemFilter.jaql.filter.all = true;
    itemFilter.jaql.filter.explicit = false;
    itemFilter.jaql.collapsed = true;
    }
    }
    });
    });


    Hope this helps!

    0
    Comment actions Permalink

Please sign in to leave a comment.