JSFiddle - React, Tailwind, and code Playground
by Flexmonster Pivot Table
HTML
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<div id="pivot-container"></div>
CSS
.highlight {
background-color: #ff0000 !important;
}
JavaScript
let pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
customizeCell: customizeCellFunction,
toolbar: true,
report: {
dataSource: {
data: getData()
},
"conditions": [{
isTotal: false,
"formula": "#value > 25",
"measure": "Debt",
"aggregation": "sum",
//Specify the member, to which the conditional formatting is applied
"member": "customer.[jeff]",
"hierarchy": "Customer",
"format": {
"backgroundColor": "red",
}
}],
}
});
/* Highlight the cell with String label "Jeff"*/
function customizeCellFunction(cell, data) {
if (data.label === "Jeff") {
cell.addClass("highlight");
}
}
function getData() {
return [{
"Customer": "John",
"Debt": 5
}, {
"Customer": "Jack",
"Debt": 30
}, {
"Customer": "Jeff",
"Debt": 35
}];
}