JavaScript does not work for Tabber
I added the following JavaScript to my tabber widget. However it does not execute. I found this JavaScript in a help article on the Sisense Community website. It is designed to change the dashboard filters based on which tab is selected. Can you please tell me what I need to do make this script work? My work around was to hide the dashboard filter and disabling the dashboard filter on each widget and creating a widget level filter.
$('.listDefaultCSS .listItemDefaultCSS', element).on('click', function(s){
widget.scriptConfig = true;
filter = prism.activeDashboard.filters.$$items.find(el=>el.jaql.title == 'Checklist Type') //Title of filter
//mapping of Tab name and filter item. Here when Tab1 is selected, 'Onboarding' will get selected in Checklists Type filter
var tabFilterMapping = {
'Tab1':"Onboarding",
'Tab2':"Advancement"
}
var filterValue = tabFilterMapping[$(s)[0].currentTarget.innerHTML]
filter.jaql.filter = {
"explicit": true,
"multiSelection": false,
"members": [
filterValue
]
}
var filterOptions = {
save: true,
refresh: true,
}
prism.activeDashboard.filters.update(filter, filterOptions)
}) ;
});
Rose Holmes-Minton
Posted 1 year ago·Last reply 1 year ago
8 comments
DRay
·1 year agoHello rholmesminton,
I’m following up to see if the solution offered by harikm007 worked for you.
If so, please click the 'Accept as Solution' button on the appropriate post. That way other users with the same questions can find the answer. If not, please let us know so that we can continue to help.
Thank you.
DRay
·1 year agoHello rholmesminton,
I’m following up to see if the solution offered by harikm007 worked for you.
If so, please click the 'Accept as Solution' button on the appropriate post. That way other users with the same questions can find the answer. If not, please let us know so that we can continue to help.
Thank you.
Rose Holmes-Minton
OP1 year agoIt works for the most part. However, the dashboard filter still displays include all.
DRay
·1 year agoGotcha. I'll ping harikm007 to see if he is able to jump back in, but I'm also reaching out internally to try and get an answer for you.
Hari KM
·1 year agoHi rholmesminton ,
I tried the above script, and it's working well.
One thing to note: make sure your tab names are correct and that the tab names in the 'tabFilterMapping' variable are in uppercase. This is important because the tabber displayed all tab names in uppercase.
Here is the updated script:
- Hari
Rose Holmes-Minton
OP1 year agoThank you for the solution. It does not change the displayed filter value. I had to hide the dashboard filter to avoid confusion for the user. It still displays as Include all regardless of which tab on the tabber is selected.
DRay
·1 year agoHi rholmesminton,
We tested internally and it worked. Can you reach out to support so they can look into this with you? Support Portal | Sisense Community
Thank you.
Rose Holmes-Minton
OP1 year agoWill do!