JSFiddle - React, Tailwind, and code Playground

Data source

by Flexmonster Pivot Table

HTML

<script src="https://cdn.flexmonster.com/flexmonster.js"></script>

<div id="pivot-container"></div>

CSS

@import url(https://cdn.flexmonster.com/assets/jsfiddle-styles.css);

JavaScript

const pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  toolbar: true,
  customizeCell: customizeCell,
  report: {
    dataSource: {
      data: getData(),
    },
    slice: {
      rows: [
        { uniqueName: "Color" },
        { uniqueName: "Country" },
        { uniqueName: "State" },
        { uniqueName: "City" },
      ],
      measures: [
        { uniqueName: "Price" },
        { uniqueName: "Open", format: "alignLeft" },
      ],
    },
    formats: [
      {
        name: "alignLeft",
        textAlign: "left",
      },
    ],
    options: {
      grid: {
        type: "flat",
      },
    },
  },
});

function customizeCell(cell, data) {
  if (data.hierarchy && data.hierarchy.uniqueName === "Open") {
    if (cell.text == "1") {
      cell.text = "Yes";
      cell.style["text-align"] = "left";
    }
    if (cell.text == "0") {
      cell.text = "No";
      cell.style["text-align"] = "left";
    }
  }
}

function getData() {
  return [
    {
      Color: "green",
      Country: "Canada",
      State: "Ontario",
      City: "Toronto",
      Price: 174,
      Open: 1,
    },
    {
      Color: "red",
      Country: "USA",
      State: "California",
      City: "Los Angeles",
      Price: 166,
      Open: 0,
    },
    {
      Color: "blue",
      Country: "USA",
      State: "Florida",
      City: "Tallahassee",
      Price: 215,
      Open: 1,
    },
    {
      Color: "black",
      Country: "Canada",
      State: "Quebec",
      City: "Montreal",
      Price: 194,
      Open: 0,
    },
  ];
}