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="pivotContainer"></div>

JavaScript

let pivot = new Flexmonster({
  container: "pivotContainer",
  componentFolder: "https://cdn.flexmonster.com/",
  toolbar: true,
  report: {
    dataSource: {
      data: getData(),
      mapping: {
        G1: {
          hierarchy: "G"
        },
        G2: {
          hierarchy: "G",
          parent: "G1"
        },
        G3: {
          hierarchy: "G",
          parent: "G2"
        },
        G4: {
          hierarchy: "G",
          parent: "G3"
        },
        G5: {
          hierarchy: "G",
          parent: "G4"
        },
        G6: {
          hierarchy: "G",
          parent: "G5"
        }
      }
    },
    options: {
      grid: {
        type: "classic"
      }
    },
    "slice": {
      "rows": [{
        "uniqueName": "G"
      }],
      "columns": [{
          "uniqueName": "Mese"
        },
        {
          "uniqueName": "[Measures]"
        }
      ],
      "measures": [{
        "uniqueName": "Measure",
        "aggregation": "sum"
      }],
      "drills": {
        "rows": [{
            "tuple": [
              "g.[profitto operativo lordo (gop)]"
            ]
          },
          {
            "tuple": [
              "g.[profitto operativo lordo (gop)].[profitto lordo].[ricavi]"
            ]
          },
          {
            "tuple": [
              "g.[profitto operativo lordo (gop)].[profitto lordo].[costi primari]"
            ]
          },
          {
            "tuple": [
              "g.[profitto operativo lordo (gop)].[costi operativi]"
            ]
          }
        ]
      }
    }
  }
});

function getData() {
  return [{
    "G1": "Profitto Operativo Lordo (GOP)",
    "G2": "Profitto Lordo",
    "G3": "Ricavi",
    "G4": "Alimenti",
    "G5": "Struttura",
    "G6": null,
    "Mese": "07 Luglio",
    "Measure": 432
  }, {
    "G1": "Profitto Operativo Lordo (GOP)",
    "G2": "Profitto Lordo",
    "G3": "Ricavi",
    "G4": "Alimenti",
    "G5": "Struttura",
    "G6": null,
    "Mese": "11 Novembre",
   ...