zach_myt
02-06-2023Data Pipeline
Hide column until drilled into
I want to hide a column until the user drills into the chart. Example of what it currently looks like below:
I would like to hide the "Videos in Module" until the user clicks the drill into. So it would look like this initially.
Then when a user clicks drill into it would look like this:
"Videos in modules" are not always the same count throughout organizations so I am unable to just display the min or max video count.
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