Showing results for 
Search instead for 
Did you mean: 
Community Team Member
Community Team Member
Sisense allows importing widgets and filters as components to be presented in different websites. This is done by SisenseJS. Sometimes, it is required to modify the widgets filters based on website attributes such as logged in user, location, previous user selections etc.
Using the below scripts, you will be able to modify the dashboard filters and save them to the server so data will be saved even when refreshing the page.
Code Snippet:
1. Modifying dashboard filters:
// Find the filter we want to change based on the dim
var filterToChange = dash.filters.$$filters.find(item => item.jaql.dim == "[Commerce.Age Range]");

if (filterToChange && filterToChange.$$model.jaql.filter){
    var members =  filterToChange.$$model.jaql.filter.members;

    // Check if we already have the member selected
    if (members && !members.includes("65+")) {
        // Push a new member to the filter

        // Save the dashboard
2. Save filters changes to the server is done by sending "true" as the second parameter to the "connect" function:
Sisense.connect('',true).then(function(app) {
3. Create and add new filter to the dashboard:
var applyFilter = function (dim, value, activeDashboard) {

    // Get the active dashboard, only run if sisense is loaded
    if (activeDashboard) {
        // Create the filter options
        var filterOptions = {
            save: true,
            refresh: true,
            unionIfSameDimensionAndSameType: false
        //  Create the jaql for the filter
        var jaql = {
            'datatype': 'text',
            'dim': dim,
            'filter': {
                'multiSelection': true,
                'members': value,
                'explicit': true
            "title": dim

        // Create the filter jaql
        var applyJaql = {
            jaql: jaql

        // Set the new filter
        activeDashboard.$$model.filters.update(applyJaql, filterOptions);
Version history
Last update:
‎03-02-2023 08:49 AM
Updated by:
Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Developers Group:

Product Feedback Forum:

Need additional support?:

Submit a Support Request

The Legal Stuff

Have a question about the Sisense Community?

Email [email protected]

Share this page: