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>

JavaScript

let pivot = new Flexmonster({
  container: "#pivot-container",
  toolbar: true,
  componentFolder: "https://cdn.flexmonster.com/",
  customizeCell: customizeCellFunction,
  report: {
    dataSource: {
      filename: "https://cdn.flexmonster.com/data/data.json"
    },
    slice: {
      "rows": [{
          "uniqueName": "Category"
        },
        {
          "uniqueName": "Country",
          "filter": {
            "measure": {
              "uniqueName": "Price",
              "aggregation": "sum"
            },
            "query": {
              "between": [
                50000,
                1100000
              ]
            }
          }
        }
      ],
      "columns": [{
          "uniqueName": "Color"
        },
        {
          "uniqueName": "[Measures]"
        }
      ],
      "measures": [{
        "uniqueName": "Price",
        "aggregation": "sum"
      }],
      "expands": {
        "rows": [{
            "tuple": [
              "category.[bikes]"
            ]
          },
          {
            "tuple": [
              "category.[cars]"
            ]
          },
          {
            "tuple": [
              "category.[clothing]"
            ]
          },
          {
            "tuple": [
              "category.[components]"
            ]
          },
          {
            "tuple": [
              "category.[accessories]"
            ]
          }
        ]
      }
    }
  },
  width: "100%",
  height: "700px",
  aftergriddraw: function(e) {
    if (e.smooth == false) {
      addExtraStyles();
    }
  }
});

function addExtraStyles() {
  let styleTag = document.createElement('style');
  rowsArrToPaint.forEach(el => {
    styleTag.innerHTML += `#fm-pivot-view .fm-grid-view div.fm-expandable-${el}.fm-cell {background-color: #4d962c !important;}`
  });
  document.head.appendChild(styleTag);
}

let rowsArrToPaint = [];
let lastParentRow = 0;

function customizeCellFunction(cell, data) {
	// detecting "parent" rows 
  if...