Forum Discussion

Apd2024's avatar
Apd2024
Data Storage
04-10-2023

Pivot Table Formatting to Highlight Entire Rows

Hi, 

I am trying to create a Pivot table widget, where certain rows are highlighted containing words "Conditional" and "Pending". 

These two data points are under a column named as "Status". 

 

So far, I have come up with this but it seems to not work: 

widget.on('ready', function() {
// Define the column index of the "Status" column
var StatusIndex = pivot.getColumnIndexById('Status');

// Loop through the table rows and highlight the rows containing "Conditional" or "Pending"
var rowEls = pivot.tableElement.find('tr');
rowEls.each(function() {
var rowEl = $(this);
var StatusCell = rowEl.find('td:eq(' + StatusIndex + ')');
var StatusValue = StatusCell.text().trim();
if (StatusValue === 'Conditional' || StatusValue === 'Pending') {
rowEl.css('background-color', 'yellow');
}
});
});

 

Can someone point me in the right direction. 

 

1 Reply

Replies have been turned off for this discussion
  • Hello! I reached out here at Sisense, and was shared this article that should be of help, you will just need to tweak it to your use case. Hope this helps!