cancel
Showing results for 
Search instead for 
Did you mean: 
taras
Sisense Team Member
Sisense Team Member

How to Change the Pivot Header Row Style with TransformPivot

This solution is based on Pivot 2.0 API supported in Sisense version L8.2.1 or later (not supported in Sisense for Windows).

For this solution, we shall use cellStyle from Pivot 2.0 API. The following options are available to adjust the cell style:

Name Type Description
fontSize number or string Text size
fontWeight number or string Text weight
fontStyle string Text style
lineHeight string Text line height
textAlign string Text alignment: 'left', 'right' or 'center'
color string Text color
backgroundColor string Cell background color
padding number or string Cell padding
borderWidth number Cell border width
borderColor string Cell border color (with CSS fallback)

Below I provide a widget script that identifies the first row in the pivot widget and utilizes transformPivot to replace the existing cell style with the new backgroundColor, color,  and textAlign. Other cellStyle parameters can be set as in the example script.

 

 

 

widget.transformPivot({},
    (metadata, cell) => {
        if (metadata.rowIndex === 0) {
            cell.style = cell.style || {};
            cell.style.backgroundColor = '#0057B7'; //sets cell background color
            cell.style.color = '#FFDD00'; //sets cell text color
            cell.style.textAlign = 'right'; //sets cell text align
        };
    }
);

 

 

 

To utilize the script, open the pivot widget in edit mode, use the three dots menu, and choose "Edit Script".

 

TS_1-1680090546134.png

 

Paste the script, save the changes, and refresh the dashboard.

 

TS_2-1680090855977.png

Enjoy the result!

Disclaimer: Please note, that this blog post contains one possible custom workaround solution for users with similar use cases. We cannot guarantee that the custom code solution described in this post will work in every scenario or with every Sisense software version. As such, we strongly advise users to test solutions in their own environment prior to deploying them to ensure that the solutions proffered function as desired in their environment. For the avoidance of doubt, the content of this blog post is provided to you “as-is” and without warranty of any kind, express, implied or otherwise, including without limitation any warranty of security and or fitness for a particular purpose. The workaround solution described in this post incorporates custom coding which is outside the Sisense product development environment and is therefore not covered by not covered by Sisense warranty and support services.

Version history
Last update:
‎02-13-2024 12:26 PM
Updated by:
Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Developers Group:

Product Feedback Forum:

Need additional support?:

Submit a Support Request

The Legal Stuff

Have a question about the Sisense Community?

Email [email protected]

Share this page: