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>

CSS

.fm-rows-sheet {
  pointer-events: none !important;
}

/* If you need to disable collapse on columns as well */
/* .fm-cols-sheet {
  pointer-events: none !important;
} */

JavaScript

let pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  toolbar: true,
  customizeCell: customizeCellFunction,
  report: {
    "dataSource": {
      "filename": "data/data.json"
    },
    "options": {
      "showReportFiltersArea": true,
      "showAllFieldsDrillThrough": true,
      "configuratorButton": true,
      "showDrillThroughConfigurator": true,
      "showFieldListSearch": true,
      "allowBrowsersCache": true,
      "grid": {
        "type": "classic",
        "title": "Ledger Details & Export",
        "showFilter": true,
        "showHeaders": false,
        "showTotals": "off",
        "showGrandTotals": "off"
      }
    },
    "slice": {
      "rows": [{
        "uniqueName": "Country"
      }, {
        "uniqueName": "Destination"
      }, {
        "uniqueName": "Category"
      }, {
        "uniqueName": "Color"
      }],
      "columns": [{
        "uniqueName": "[Measures]"
      }],
      "measures": [{
        "uniqueName": "Price"
      }],
      "expands": {
        "expandAll": true
      },
    },
  },
});

/*
Hide collapse icons & fill empty cells
*/
function customizeCellFunction(cell, data) {
  if (data && data.type == "header" &&
    data.member && data.member.caption != 'All' &&
    data.label == "") {
    cell.text = data.member.caption;
  }

  if (data.hierarchy && data.member) {
    cell.text = data.escapedLabel;
  }
}

/*
Remove "Collapse" from context menu
*/
flexmonster.customizeContextMenu(function(items, data, viewType) {
  items = items.filter(function(item) {
    return item.label !== "Collapse"
  })
  return items;
});