Filter Members Limitation

Comments

4 comments

  • Avatar
    Iris Maessen

    Is the limitation on 'Widget affects dashboard filters' only for widgets that would set one of the limited filters, or would this apply to *all* widgets?

     

    Iris

  • Avatar
    Leo Lei

    Hi Lidor, is there a way to disable the "include all" in the filter as well?

  • Avatar
    Vinay Madala

    SyntaxEditor Code Snippet

    JQuery Solution: Add the following script in your dashboard script

    change the variables limit, filter_name in applyLimitFilter function based on your requirement

    works in Sisense 6.7.1 version

    var myVar;
    
    function applyLimitFilter() {
     var limit = 2; // maximum number of filter members to be selected
     var filter_name = 'Time Period'; // Displayed name as it appears on dashboard
         
      try{
       var filters = $('.ew-i-caption');
    
        $.each( filters, function(i) {
            if(filters[i].textContent===filter_name){
                if($(filters[i]).siblings('.ew-i-fx.ew-i-act.running').length>0 || $(filters[i]).siblings('.ew-i-fx.ew-i-act.f-act.running' ).length>0){
                    var el = $('.uc-tagline-content').find('.scroll.has-scrollbar').find('.content').find('.uc-tag.single');
                    var checkall = $('.filterHeader').find('.checkmode-toggle.select-all').find('.uc-chk-icon-blue.uc-chk-icon-empty').length;
                    if((el.length) > limit || checkall <1 || el[0].innerText==='Include all' ) {
                        $('.uc-ok').addClass('disabled');
                        $('.uc-ok').attr('style','pointer-events: none;');
                    }
                    else{
                        $('.uc-ok').removeClass('disabled');
                        $('.uc-ok').removeAttr('style');
                    }
                }
            }
        });
       }catch(err){}
    }
    
    function stopLimitFilter() {
      clearInterval(myVar);
    }
    
    dashboard.on('initialized', function (d) {
       myVar = setInterval(function(){ applyLimitFilter() }, 200);
    })
    
    dashboard.on('destroyed', function(d){
       stopLimitFilter();
    });

     

  • Avatar
    Iris Maessen

    I've recently found that this plugin interferes with Advanced filter functionality on date filters; even though the filter limitation is not set on the date filter.

Please sign in to leave a comment.