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

.color-yellow {
  color: #FFD500 !important;
}

.color-green {
  color: #4DB25E !important;
}

.color-red {
  color: #EB4747 !important;
}

.color-blue {
  color: #33B2CC !important;
}

.background {
  background-color: #F5F5F5 !important;
}

JavaScript

new Flexmonster({
  container: "#pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  toolbar: true,
  customizeCell: customizeCellFunction,
  report: {
    dataSource: {
      type: "csv",
      filename: "https://cdn.flexmonster.com/data/data.csv"
    },
    slice: {
      expands: {
        expandAll: true
      },
      rows: [{
        uniqueName: "Country",
      }, ],
      columns: [{
        uniqueName: "Business Type",
        filter: {
          members: ['Warehouse']
        }
      }, {
        uniqueName: "Color",
        filter: {
          members: ["red", "green", "blue", "yellow"]
        }
      }, {
        uniqueName: "[Measures]"
      }],
      measures: [{
        uniqueName: "Price",
        aggregation: "sum"
      }]
    },

  }
});

function customizeCellFunction(cell, data) {
  const columnValues = ["red", "green", "blue", "yellow"];
  if (data.type == "value") {
    if (data.columns) {
      data.columns.forEach(column => {
        if (column.hierarchyName === "Color") {
          //Do anything with all column values
          cell.addClass('background')
          if (columnValues.includes(column.caption)) {
            //do anything with specific value
            cell.addClass(`color-${column.caption}`)
          }
        }
      })
    }
  }
}