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="exportToExcel()">
Export to Excel
</button>
<button onclick="exportToPDF()">
Export to PDF
</button>
<div id="pivot-container"></div>

JavaScript

new Flexmonster({
  container: "#pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  width: "100%",
  height: 550,
  toolbar: true,
  report: {
    "dataSource": {
      "type": "json",
      "mapping": {
        "Quantity": {
          "type": "number"
        },
        "Price": {
          "type": "number"
        },
        "Retail Category": {
          "type": "string"
        },
        "Sales": {
          "type": "number"
        },
        "Order Date": {
          "type": "year/quarter/month/day"
        },
        "Date": {
          "type": "date"
        },
        "Status": {
          "type": "string"
        },
        "Product Code": {
          "type": "string"
        },
        "Phone": {
          "type": "number"
        },
        "Country": {
          "type": "level",
          "hierarchy": "Location"
        },
        "City": {
          "type": "level",
          "hierarchy": "Location",
          "parent": "Country"
        },
        "CurrencyID": {
          "type": "property",
          "hierarchy": "Country"
        },
        "Contact Last Name": {
          "type": "string"
        },
        "Contact First Name": {
          "type": "string"
        },
        "Deal Size": {
          "type": "string"
        }
      },
      "filename": "https://cdn.flexmonster.com/data/retail-data.json"
    },
    "slice": {
      "reportFilters": [{
          "uniqueName": "Date.Year",
          "filter": {
            "members": [
              "date.year.[2019]"
            ]
          }
        },
        {
          "uniqueName": "Date.Month"
        }
      ],
      "rows": [{
          "uniqueName": "Location"
        },
        {
          "uniqueName": "Retail Category",
          "filter": {
            "members": [
              "retail category.[books & movies]",
              "retail category.[cellphones & accessories]",
              "retail category.[health & personal care]"
            ]
          }
       ...