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.