cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member
In some cases for design or reporting you would like to control the size of your pivot2 columns.
The example bellow is for a table with 4 columns 0-3:
// Add new width for desired columns
// Columns count should start from 0
var newWidth = {
0: 100,
1: 50,
2: 100,
3: 150,
}
var columnsToRemove = []
var passed = -1
var wasExecuted = false

widget.on('processresult', function(widget, args){
if (!wasExecuted) {
args.result.metadata.forEach(function(e, index) {
e.panel
if (e.panel != "scope" ) {

index = Object.keys(newWidth).length  - index+passed;

if ( typeof(newWidth[index]) !== "undefined"   ) {
 if (!('format' in e)){
  e['format'] = { 'width': newWidth[index]};
 }
 else{
  e['format'] ['width'] =  newWidth[index];
 }
}
if (e.format.width === 0) {
columnsToRemove.push(index)
}
}
else {
passed ++

}
})
wasExecuted = true
}
})

widget.on('ready', function() {
columnsToRemove.forEach(function(item) {
var selector = "[class*=table-grid__cell--col-" + item +"]";
$(selector, element).each(function(i, lmnt) {
$(lmnt).text('')
})
})
}) 
Rate this article:
Version history
Last update:
‎03-02-2023 09:24 AM
Updated by:
Contributors