JSFiddle - React, Tailwind, and code Playground
by Flexmonster Pivot Table
HTML
<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<button onclick="highlight()">Highlight</button>
<button onclick="removeHighlight()">Remove Highlight</button>
<div id="pivot-container"></div>
CSS
.highlight{
background: #8ca6b9 !important;
}
JavaScript
var pivot = new Flexmonster({
container: "#pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
customizeCell: customizeCellFunction,
report: {
dataSource: {
dataSourceType: "json",
data: getData()
},
slice: {
rows: [
{
uniqueName: "Patient SupplementalOxygen"
},
{
uniqueName: "Patient TemperatureScore"
},
{
uniqueName: "Patient PulseScore"
}
],
columns: [
{
uniqueName: "[Measures]"
}
],
measures: [
{
uniqueName: "Patient TemperatureScore",
aggregation: "sum"
},
{
uniqueName: "Patient PulseScore",
aggregation: "sum"
}
],
flatOrder: [
"Patient SupplementalOxygen",
"Patient Pulse",
"Patient PulseScore",
"Patient Temperature",
"Patient TemperatureScore"
]
},
options: {
grid: {
type: "flat"
}
},
conditions: [
{
formula: "#value = 3",
measure: "Patient PulseScore",
format: {
backgroundColor: "#F44336",
color: "#000000",
fontFamily: "Arial",
fontSize: "12px"
}
},
{
formula: "#value = 3",
measure: "Patient TemperatureScore",
format: {
backgroundColor: "#F44336",
color: "#000000",
fontFamily: "Arial",
fontSize: "12px"
}
}
]
},
width: "100%",
height: 400,
});
function customizeCellFunction(cell, data) {
console.log(data);
if(data.hierarchy && data.hierarchy.uniqueName == "Patient SupplementalOxygen" && data.label...