Sometimes, you may need to apply a filter to your dashboard without making it visible. Below is a script that allows you to hide one or more dashboard filters.
Steps:
Open the dashboard where you want to hide the filter.
Add the script below, ensuring you update the 'filterTitles' variable with the list of filters you wish to hide.
Save the script and refresh the dashboard.
const filterTitles = ['Category', 'Condition'];
dashboard.on('initialized', (dash, args) => {
dash.filters.$$items.forEach((item, index) => {
if (filterTitles.includes(item.jaql.title)) {
var styles = `
.global-filters .ew-content-host .ew-panel .ew-item-wrapper:nth-child(${index+2}) {
display: none;
}`
var styleSheet = document.createElement("style")
styleSheet.innerText = styles
document.head.appendChild(styleSheet)
}
})
})
Comentarios