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.

5 REPLIES 5

Jijish
8 - Cloud Apps
8 - Cloud Apps

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

rapidbisupport
11 - Data Pipeline
11 - Data Pipeline

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

DRay
Community Team Leader
Community Team Leader

Hello @panjoshi and @Jijish,

I know it's been a while, but I’m following up to see if the solution offered by @rapidbisupport worked for you.

If so, please click the 'Accept as Solution' button on their 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.

David Raynor (DRay)

reporting-mryum
8 - Cloud Apps
8 - Cloud Apps

HI @DRay, this solution doesn't work for us as we are using iFrame embedding and this will get blocked by browser security. How would you securely share via WAT embedding and hide the filters to prevent people from toggle off the filter and access more data than they should? 

DRay
Community Team Leader
Community Team Leader

Hi @reporting-mryum,

There should not be any issues with Sisense Dashboard scripts running in an iFrame. The script runs inside Sisense, the browser isn't involved at all.

David Raynor (DRay)