Ophir_Buchman
06-16-2022Data Integration
Pivot 2.0 - Hiding Columns from the Display
When creating a Pivot 2.0 chart (Linux) you may want to hide a specific column.
There are various reasons for doing so:
- I want to sort by a column that shouldn't be displayed
- I want to display a column when exporting the table to Excel or CSV, but hide it on the dashboard
Add the following widget script to your pivot chart:
columnsToHide = [3,4]
widget.transformPivot(
{},
function (metadata, cell)
{
columnsToHide.forEach(function(col) {
if (metadata.colIndex == col) { // Add a second condition ( && metadata.rowIndex > 0 ) if you want to keep the table header
cell.content = ' '
cell.style = {
maxWidth: '0px',
borderColor: 'white',
color: 'white'
}
}
})
}
);
Before | After |