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="expandAll()">
Expand all
</button>
<button onclick="collapseAll()">
Collapse all
</button>
<div id="pivot-container"></div>

JavaScript

var pivot = new Flexmonster({
  container: "#pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  width: "100%",
  height: 550,
  toolbar: true,
  report: {
    dataSource: {
      type: "api",
      url: "https://olap.flexmonster.com:9500",
      index: "fm-product-sales",
      mapping: {
        "Category": {
          folder: "Item"
        },
        "Business Type": {
          folder: "Item"
        },
        "Color": {
          folder: "Item"
        }
      }
    },
    slice: {
      rows: [{
        uniqueName: "Country"
      }, {
        uniqueName: "Business Type",
      }, {
        uniqueName: "Color",
      }, {
        uniqueName: "Destination"
      }, ],
      measures: [{
        uniqueName: "Price",
        aggregation: "sum"
      }]
    }
  }
});


function expandAll(index) {
  this.pivot.expandAllData();
}


function collapseAll(index) {
  this.pivot.collapseAllData();
}