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>
<div id="pivot-container"></div>
CSS
.emptyCell {
background-color: #d9ffe3 !important;
}
JavaScript
var pivot = new Flexmonster({
container: "#pivot-container",
toolbar: true,
componentFolder: "https://cdn.flexmonster.com/",
customizeCell: customizeCellFunction,
report: {
dataSource: {
type: "csv",
filename: "data/data.csv"
},
slice: {
rows: [{
"uniqueName": "Country"
}],
columns: [{
"uniqueName": "Color"
},
{
"uniqueName": "Category"
},
{
"uniqueName": "Destination"
},
{
"uniqueName": "[Measures]"
}
],
measures: [{
"uniqueName": "Price",
"aggregation": "sum"
}],
expands: {
"expandAll": true,
"columns": [{
"tuple": [
"color.[blue]",
"category.[bikes]"
]
},
{
"tuple": [
"color.[blue]"
]
},
{
"tuple": [
"color.[green]",
"category.[bikes]"
]
},
{
"tuple": [
"color.[green]"
]
}
]
}
},
options: {
grid: {
"showTotals": "off"
}
},
},
width: "100%",
height: 700
});
function customizeCellFunction(cell, data) {
if (!data.collapsed && !data.expanded && data.isTotal && data.type == "value" && !data.isGrandTotal) {
cell.addClass("emptyCell");
cell.text = "";
}
}