JSFiddle - React, Tailwind, and code Playground

by Flexmonster Pivot Table

HTML

<link rel="stylesheet" href="https://cdn.flexmonster.com/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<button onclick="updateDataPartial()">Partial update</button>
<button onclick="updateData()">update</button>
<div id="pivot-container"></div>

JavaScript

var pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  width: "100%",
  toolbar: true,
  height: 430,
  report: {
    dataSource: {
      data: getData()
    },
    slice: {
      "rows": [{
        "uniqueName": "Category"
      }],
      "columns": [{
          "uniqueName": "Color"
        },
        {
          "uniqueName": "[Measures]"
        }
      ],
      "measures": [{
        "uniqueName": "Price",
        "aggregation": "sum"
      }]
    },
    options: {
    	grid: {
      	type: "compact"
      }
    }
  }
});

function updateDataPartial() {
  var data = [{
    "Category": "Cars",
    "Color": "pink",
    "Price": 51844,
    "RowId": 4
  }]
  flexmonster.updateData({
    data: data
  }, {
    partial: true
  });
}

function updateData() {
  var data = [{
      "Category": "Accessories",
      "Color": "grey",
      "Price": 457,
      "RowId": 1
    },
    {
      "Category": "Bikes",
      "Color": "red",
      "Price": 568,
      "RowId": 2
    },
    {
      "Category": "Clothing",
      "Color": "red",
      "Price": 436,
      "RowId": 3
    }
  ]
  flexmonster.updateData({
    data: data
  }, {
    partial: false
  });
}

function getData() {
  return [{
      "Category": {
        "type": "string"
      },
      "Color": {
        "type": "string"
      },
      "Price": {
        "type": "number"
      },
      "RowId": {
        "type": "id"
      },
      "DeleteRow": {
        "type": "delete"
      }
    },
    {
      "Category": "Accessories",
      "Color": "pink",
      "Price": 242,
      "RowId": 1
    },
    {
      "Category": "Bikes",
      "Color": "green",
      "Price": 1487,
      "RowId": 2
    },
    {
      "Category": "Clothing",
      "Color": "green",
      "Price": 40,
      "RowId": 3
    }
  ]
}