Pivot Table Lines Extend Beyond Table
We have users complaining that dashboards look messy because if a Pivot Table is the only widget in a 'row' in a dashboard, the lines continue all the way to the end of the dashboard. The lines should stop when the widget stops.
-
Hey Jessica,
You can also use this script, which will dynamically expand the width of the fields to take up the entire space of the pivot:
// Export to PDF will not execute the script...so pivot will render as if there was no script
widget.on("domready", function(w, args){
var tag = $('tr#pivot__ACCRowArea', element)[0];
var numGroups = $('td.p-dim-head', tag).length;
var tagWidth = tag.offsetWidth;
var numCols = tag.children.length;
var pivotWidth = $("div.p-fixed-rows", element)[0].offsetWidth;
var groupWidth = 0;
if(pivotWidth > tagWidth) {
for(var i=0; i<numCols; i++) {
if(i < numGroups) {
groupWidth += (Math.trunc(tag.children[i].offsetWidth * pivotWidth / tagWidth));
}
$('[fidx=' + i + ']', element).width(Math.trunc(tag.children[i].offsetWidth * pivotWidth / tagWidth));
}
$(".p-fixed-cols", element).width(groupWidth);
$(".p-fixed-corner", element).width(groupWidth);
$("td.phantom", element).width(0);
}
else {
console.log("script couldn't execute as their wasn't enough space to expand the pivot");
}
})
Best,
Elliott -
Malinda Jepsen Thank you for the code! That worked perfect for me too! I'm curious, and I have no experience with it, but could this code be put into it's own plugin so that it is applied to all pivots on all dashboards?
Best Regards,
Chris
-
Chris Bridges I'm not great with developing plugins, so I'm not sure. Someone who develops plugins might be able to help?
Please sign in to leave a comment.
Comments
6 comments