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>
JavaScript
const pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
height: 500,
customizeCell: customizeCellFunction,
report: {
dataSource: {
filename: "data/data.json",
},
options: {
grid: {
showTotals: "off",
},
},
slice: {
rows: [
{
uniqueName: "Country",
},
{
uniqueName: "Color",
},
],
columns: [
{
uniqueName: "Category",
},
{
uniqueName: "[Measures]",
},
],
measures: [
{
uniqueName: "Price",
},
],
},
formats: [
{
name: "",
nullValue: " ",
},
],
},
})
function customizeCellFunction(cell, data) {
if (data.label === "") {
//Highlight is used to showcase that the empty subtotal row is clearly identified
cell.style.background = "#DDD"
}
}