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,
  report: {
    dataSource: {
      data: getData()
    },
    "slice": {
        "columns": [
            {
                "uniqueName": "Ticket"
            },
            {
                "uniqueName": "FLIGHT_DATE",
                "caption": "Flight Date"
            },
            {
                "uniqueName": "[Measures]"
            }
        ],
        "measures": [
            {
                "uniqueName": "Price",
                "aggregation": "sum"
            }
        ]
    }
  },
  
});

pivot.on("reportcomplete", expand);

function expand() {
  pivot.off("reportcomplete", expand);
  pivot.expandData('Ticket');
}



function getData() {
  return [{
    "FLIGHT_DATE": {
      caption: "Flight Date",
      type: "year/quarter/month/day"
    },
    "Price": {
      caption: "Price",
      type: "number"
    },
    "Ticket": {
      caption: "Ticket",
      type: "string"
    }
  }, {
    "FLIGHT_DATE": "05/20/2016",
    "Price": 1000,
    "Ticket": "ticket1"
  }, {
    "FLIGHT_DATE": "06/20/2016",
    "Price": 1000,
    "Ticket": "ticket2"
  }, {
    "FLIGHT_DATE": "05/03/2016",
    "Price": 1000,
    "Ticket": "ticket3"
  }, {
    "FLIGHT_DATE": "07/25/2016",
    "Price": 1000,
    "Ticket": "ticket4"
  }];
}