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

const pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  toolbar: true,
  customizeCell: customizeCellFunction,
  report: {
    dataSource: {
      data: getData()
    },
    slice: {
      rows: [{
          uniqueName: "Color"
        },
        {
          uniqueName: "Country"
        }
      ],
      columns: [{
        uniqueName: "State"
      }, {
        uniqueName: "City"
      }, {
        uniqueName: "[Measures]"
      }],
      measures: [{
        uniqueName: "Price",
        aggregation: "sum"
      }],
      expands: {
        columns: [{
          tuple: [
            "state.[florida]"
          ]
        }]
      }
    },
    options: {
      grid: {
        showTotals: "off",
        showGrandTotals: "off"
      }
    },
  }
});

function customizeCellFunction(cell, data) {
  if (data.type && data.type == "value" && data.value &&
    (data.columns.length < 2 && data.rows.length < 2)
  ) {
    cell.text = ""
  }
}


function getData() {
  return [{
      "Color": "green",
      "Country": "Canada",
      "State": "Ontario",
      "City": "Toronto",
      "Price": 174,
      "Quantity": 22
    },
    {
      "Color": "red",
      "Country": "USA",
      "State": "California",
      "City": "Los Angeles",
      "Price": 166,
      "Quantity": 19
    },
    {
      "Color": "blue",
      "Country": "USA",
      "State": "Florida",
      "City": "Tallahassee",
      "Price": 215,
      "Quantity": 25
    },
    {
      "Color": "black",
      "Country": "Canada",
      "State": "Quebec",
      "City": "Montreal",
      "Price": 194,
      "Quantity": 15
    }
  ]
}