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>

JavaScript

var pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  width: "100%",
  height: 430,
  toolbar: true,
  customizeCell: customizeCellFunction,
  report: {
    dataSource: {
      data: getData()
    },
    "slice": {
      "rows": [{
        "uniqueName": "[Measures]"
      }],
      "columns": [{
        "uniqueName": "Type"
      }],
      "measures": [{
        "uniqueName": "Availability",
        "grandTotalCaption": "Availability",
        "formula": "count('Type')"
      }]
    },
  }
});

function customizeCellFunction(cell, data) {
    if (data.measure == null && data.isGrandTotal == true && data.type == "header") cell.text = "All rooms"
}

function getData() {
  return [{
      "Room number": {
        type: "string"
      },
      "Type": {
        type: "string"
      },
      "Price": {
        type: "number"
      }
    },
    {
      "Room number": "1",
      "Type": "Double",
      "Price": 210
    },
    {
      "Room number": "2",
      "Type": "Double",
      "Price": 90
    },
    {
      "Room number": "3",
      "Type": "Suite",
      "Price": 250
    },
    {
      "Room number": "4",
      "Type": "Single",
      "Price": 150
    },
    {
      "Room number": "5",
      "Type": "Double",
      "Price": 80
    },
    {
      "Room number": "6",
      "Type": "Quadruple",
      "Price": 250
    },
    {
      "Room number": "7",
      "Type": "Suite",
      "Price": 150
    },
    {
      "Room number": "8",
      "Type": "Suite",
      "Price": 50
    },
    {
      "Room number": "9",
      "Type": "Single",
      "Price": 50
    }
  ];;
}