cancel
Showing results for 
Search instead for 
Did you mean: 

Hide column until drilled into

zach_myt
10 - ETL
10 - ETL

I want to hide a column until the user drills into the chart. Example of what it currently looks like below:

zach_myt_1-1675717179390.png

I would like to hide the "Videos in Module" until the user clicks the drill into. So it would look like this initially.

zach_myt_2-1675717305528.png

Then when a user clicks drill into it would look like this:

zach_myt_3-1675717362327.png

"Videos in modules" are not always the same count throughout organizations so I am unable to just display the min or max video count.

 

1 ACCEPTED SOLUTION

harikm007
13 - Data Warehouse
13 - Data Warehouse

Hi @zach_myt ,

 Try this widget script: 

(Disable the column 'Videos in Module' and the script will enable when you drill into. Below script works if 'Videos in Module' is a dimension. Update the line 8 and 17 as mentioned in the comment if 'Videos in Module' is a calculated column.)

widget.on("buildquery", function (se, ev) { 
	
	let columntoShow = 'Videos in Module' 
	
	let drilledColumn = ev.query.metadata.find(el=>el.parent)
	
	if(drilledColumn){
		$.each(ev.widget.metadata.panels[0].items, function(index, value){  //use 1 instead of 0 if it is a calculated panel
			if(value.disabled == true && value.jaql.title == columntoShow) 
			{ 
				var newJaql = { 
					jaql  : JSON.parse(JSON.stringify(value.jaql)) 
				} 
				ev.query.metadata.push(newJaql) 
				lastIndex = ev.query.metadata.length - 1 
				ev.query.metadata[lastIndex].disabled = false	 
				ev.query.metadata[lastIndex].panel = 'rows' //use 'measures' if it is a calculated panel
			} 
		}) 
	
	}

})

-Hari

 

View solution in original post

5 REPLIES 5

Benji_PaldiTeam
11 - Data Pipeline
11 - Data Pipeline

Hi @zach_myt ,

What you are actually looking to achieve is interactiveness when using table\pivot widgets.
You might be interested in a stable code-free solution which is the "Control Table Columns" or the "Expandable Pivot "by Paldi solutions.

With those plugins, viewers get expand\collapse capability and can decide which columns they want to see and which they want to hide.

Let me know if you would like to trial those plugins and feel free to reach out of you have any further questions, we're always happy to help (: 

 

Paldi Solutions - Number #1 Sisense Plugins Developer 

zach_myt
10 - ETL
10 - ETL

I am really looking for something that doesn't require a plugin. Is there some type of work around that can accomplish the same type of functionality? 

harikm007
13 - Data Warehouse
13 - Data Warehouse

Hi @zach_myt ,

 Try this widget script: 

(Disable the column 'Videos in Module' and the script will enable when you drill into. Below script works if 'Videos in Module' is a dimension. Update the line 8 and 17 as mentioned in the comment if 'Videos in Module' is a calculated column.)

widget.on("buildquery", function (se, ev) { 
	
	let columntoShow = 'Videos in Module' 
	
	let drilledColumn = ev.query.metadata.find(el=>el.parent)
	
	if(drilledColumn){
		$.each(ev.widget.metadata.panels[0].items, function(index, value){  //use 1 instead of 0 if it is a calculated panel
			if(value.disabled == true && value.jaql.title == columntoShow) 
			{ 
				var newJaql = { 
					jaql  : JSON.parse(JSON.stringify(value.jaql)) 
				} 
				ev.query.metadata.push(newJaql) 
				lastIndex = ev.query.metadata.length - 1 
				ev.query.metadata[lastIndex].disabled = false	 
				ev.query.metadata[lastIndex].panel = 'rows' //use 'measures' if it is a calculated panel
			} 
		}) 
	
	}

})

-Hari

 

Hi Hari,

This script makes sense but it isn't affecting my widget at all. I saved it in edit script window, refreshed, drilled down but it is same behavior with 'Videos in Module' not displaying on drill down. I am fairly new to Sisense, is there a way I can debug this to step through and see what is happening?  Or do you have any other suggestions?

Hari, this works now! Looks like I had a typo in column on one of my widgets. Thank you for this, its perfect!