cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Hide dashboard filter based on filter title

panjoshi
7 - Data Storage
7 - Data Storage

I'm looking for ways to hide certain dashboard filters based on their title name. Is there a way to do the same? Also, the filters will be added as dependent. For e.g. we can have these 4 dependent filters Filter1 >> Filter2 >> Filter_3 >> Filter4 and we need to hide the one with an underscore in its name.

2 REPLIES 2

Jijish
8 - Cloud Apps
8 - Cloud Apps

I have a similar requirement as well. Any inputs on this thread please ?

rapidbisupport
10 - ETL
10 - ETL

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:

rapidbisupport_1-1701669455127.png

After:

rapidbisupport_0-1701669433739.png

 

Please let me know if this works for you?

Thanks,

Daniel

RAPID BI

[email protected]

RAPID BI - Sisense Professional Services | Implementations | Custom Add-ons