Forum Discussion
Hi panjoshi,
You can try the following dashboard script that works with dependent filters:
const filterToHide = 'Month'
dashboard.on('initialized', (d, args) => {
let depFilterPos, filterPos, k
for (let i = 0; i < d.filters.$$items.length; i++) {
let filter = d.filters.$$items[i]
if (!defined(filter.levels)) { continue }
for (let j = 0; j < filter.levels.length; j++) {
let level = filter.levels[j]
if (level.title === filterToHide) {
depFilterPos = i + 2
filterPos = j + 1
}
}
}
console.log(depFilterPos, filterPos)
var styles = `
.ew-panel > .f-wrapper:nth-child(${depFilterPos}) > .ew-item > .f-group > .f-mini-host:nth-child(${filterPos}) {
display: none;
}
`
var styleSheet = document.createElement("style")
styleSheet.innerText = styles
document.head.appendChild(styleSheet)
})
What the above is doing is searching for the filterToHide title in dependent filters in the filters panel. It then records the 'dependent filter index' and 'filter index' so that we can change the CSS for this element as display: none.
This worked on my side in a limited testing scenario. You will need to refresh the dashboard if any changes are made to the filter shelf order.
Before:
After:
Please let me know if this works for you?
Thanks,
Daniel
RAPID BI
daniel.ranisavljevic@rapidbi.com.au
RAPID BI - Sisense Professional Services | Implementations | Custom Add-ons
- kgupta_egencia07-23-2025Cloud Apps
Hi DRay ,
Why we are doing +2 increment for filter index, it should be +1.
- DRay07-24-2025Sisense Employee
Hi kgupta_egencia,
Did you mean to tag rapidbisupport?
- taras07-31-2025Sisense Employee
Hi kgupta_egencia ,
As we confirmed today, the extra +2 comes from the filterRelationsEnabled feature flag, which adds an additional <div> to the ew-panel that needs to be accounted for when constructing the selector. If this feature is disabled, then +1 should be applied instead.
Below is an updated script example that should work in both scenarios, whether filter relationships are enabled or disabled:
const filterToHide = 'Month' dashboard.on('initialized', (d, args) => { let depFilterPos, filterPos, k const feature = prism.features.find( (item) => item.key === "filterRelationsEnabled"); for (let i = 0; i < d.filters.$$items.length; i++) { let filter = d.filters.$$items[i] if (!defined(filter.levels)) { continue } for (let j = 0; j < filter.levels.length; j++) { let level = filter.levels[j] if (level.title === filterToHide) { depFilterPos = 0 depFilterPos += feature && feature.active ? i + 2 : i + 1 filterPos = j + 1 } } } console.log(depFilterPos, filterPos) var styles = ` .ew-panel > .f-wrapper:nth-child(${depFilterPos}) > .ew-item > .f-group > .f-mini-host:nth-child(${filterPos}) { display: none; } ` var styleSheet = document.createElement("style") styleSheet.innerText = styles document.head.appendChild(styleSheet) })
- kgupta_egencia09-03-2025Cloud Apps
rapidbisupport this is not working on latest version sisense 2025.3