JSFiddle - React, Tailwind, and code Playground

Events

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">The component will appear here</div>

CSS

.output {
  width: 80%;
  height: 300px;
  margin-left: auto;
  margin-right: auto;
  padding: 20px;
  background: rgba(242, 242, 242, 1);
  font-family: Menlo, Monaco, "Courier New", Courier, monospace;
  white-space: pre-wrap;
  font-size: 16px;
  font-weight: 400;
  overflow-y: scroll;
  margin-top: 20px;
  margin-bottom: 10px;
}

code {
    font-size: 105%;
    color: #DF3800;
    background-color: #f5f5f5;
    padding: 1px 4px;
    font-family: monospace !important;
    border-radius: 4px;
}

p {
  font-size: 15px;
  line-height: 1.5;
  padding-right: 10px;
  padding-left: 10px;
}

a {
  color: #00a45a;
  text-decoration: none;
}

JavaScript

var pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  height: 290,
  report: {
    dataSource: {
      data: getData(),
      mapping: {
        RecordID: {
          type: "id",
        },
      },
    },
  },
})

pivot.on("cellclick", function (cell) {
  console.log(cell.recordId)
})

function getData() {
  return [
    {
      Color: "green",
      M: "September",
      W: "Wed",
      Country: "Canada",
      State: "Ontario",
      City: "Toronto",
      Price: 174,
      Quantity: 22,
      RecordID: 1,
    },
    {
      Color: "red",
      M: "March",
      W: "Mon",
      Time: "1000",
      Country: "USA",
      State: "California",
      City: "Los Angeles",
      Price: 1664,
      Quantity: 19,
      RecordID: 2,
    },
    {
      Color: "red",
      M: "January",
      W: "Mon",
      Country: "Canada",
      State: "Quebec",
      City: "Montreal",
      Price: 1190,
      Quantity: 292,
      RecordID: 3,
    },
    {
      Color: "green",
      D: "04/08/2014",
      M: "August",
      W: "Fri",
      Time: "1000",
      Country: "USA",
      State: "California",
      City: "Los Angeles",
      Price: 1222,
      Quantity: 730,
      RecordID: 4,
    },
    {
      Color: "white",
      M: "March",
      W: "Wed",
      Country: "USA",
      State: "California",
      City: "Los Angeles",
      Price: 7941,
      Quantity: 73,
      RecordID: 5,
    },
    {
      Color: "red",
      M: "August",
      W: "Wed",
      Country: "Canada",
      State: "Ontario",
      City: "Toronto",
      Price: 6829,
      Quantity: 19,
      RecordID: 6,
    },
    {
      Color: "green",
      M: "January",
      W: "Wed",
      Country: "Canada",
      State: "Quebec",
      City: "Montreal",
      Price: 2995,
      Quantity: 98,
      RecordID: 7,
    },
    {
      Color: "white",
      M: "February",
      W: "Mon",
      Country: "USA",
      State: "California",
      City: "Los Angeles",
  ...