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

#fm-pivot-view .fm-grid-view div.fm-cell.bold {
  font-weight: bold !important;
}

#fm-pivot-view .fm-grid-view div.fm-cell.italic {
  font-style: italic !important;
}

JavaScript

let pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  height: 430,
  toolbar: true,
  customizeCell: customizeCellFunction,
  report: {
    dataSource: {
      data: getData(),
      mapping: {
        "Style": {
          type: "property",
          hierarchy: "Product"
        }
      }
    },
    slice: {
      rows: [{
        uniqueName: "Product"
      }],
      columns: [{
        uniqueName: "[Measures]"
      }],
      measures: [{
        uniqueName: "Price"
      }]
    }
  }
});


function customizeCellFunction(cell, data) {
  console.log(data);
  if (data.rows && data.rows.length > 0 && data.rows[0].properties) {
    if (data.rows[0].properties.Style == 'G') {
      cell.addClass("bold");
    } else if (data.rows[0].properties.Style == 'C') {
      cell.addClass("italic");
    }
  }

}

function getData() {
  return [{
      "Product": "Banana cake",
      "Style": "G",
      "Price": 24
    },
    {
      "Product": "Chocolate",
      "Price": 31
    },
    {
      "Product": "Ice-cream",
      "Price": 28
    },
    {
      "Product": "Pie",
      "Style": "G",
      "Price": 43
    },
    {
      "Product": "Croissant",
      "Style": "C",
      "Price": 56
    },
    {
      "Product": "Biscuits",
      "Style": "C",
      "Price": 35
    },

  ];
}