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>
<div id="pivot-container2"></div>

JavaScript

let pivot = new Flexmonster({
  container: "#pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  width: "100%",
  height: 350,
  report: {
    options: {
      grid: {
        title: "Date hierarchy",
      },
    },
    dataSource: {
      type: "api",
      url: "https://olap.flexmonster.com:9500",
      index: "data-types",
      mapping: {
        date_year: {
          hierarchy: "Date",
          caption: "Year",
        },
        date_month: {
          hierarchy: "Date",
          parent: "date_year",
          caption: "Month",
        },
        date_day: {
          hierarchy: "Date",
          parent: "date_month",
          caption: "Day",
        },
      },
    },
    slice: {
      rows: [
        {
          uniqueName: "country",
        },
      ],
      columns: [
        {
          uniqueName: "Date",
          levelName: "date_month",
        },
        {
          uniqueName: "[Measures]",
        },
      ],
      measures: [
        {
          uniqueName: "price",
          aggregation: "sum",
        },
      ],
    },
  },
})

new Flexmonster({
  container: "#pivot-container2",
  componentFolder: "https://cdn.flexmonster.com/",
  width: "100%",
  height: 350,
  report: {
    options: {
      grid: {
        title: "Date folder",
      },
    },
    dataSource: {
      type: "api",
      url: "https://olap.flexmonster.com:9500",
      index: "data-types",
      mapping: {
        date_year: {
          folder: "Date",
          caption:"Year"
        },
        date_month: {
          folder: "Date",
          caption: "Month",
        },
        date_day: {
          folder: "Date",
          caption: "Day",
        },
      },
    },
    slice: {
      rows: [
        {
          uniqueName: "country",
        },
      ],
      columns: [
        {
          uniqueName: "date_month",
        },  {
          uniqueName: "date_day",
        },
        {
          uniqueName: "[Measures]",
        },
      ],
     ...