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>
<h3>
  Click on the cell, change value and press enter
</h3>
<div id="pivot-container"></div>

CSS

.editable {
  padding: 0 !important;
  z-index: 1 !important;
}

.editable input {
  width: 100%;
  height: 100%;
  background-color: transparent;
  border: 0px solid;
  padding-left: 4px !important;

}

JavaScript

new Flexmonster({
  container: "#pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  beforetoolbarcreated: customizeToolbar,
  width: "100%",
  height: 600,
  toolbar: true,
  report: {
    dataSource: {
      filename: "data/data.csv"
    },
    slice: {
      rows: [{
          uniqueName: "Color"
        },
        {
          uniqueName: "[Measures]"
        }
      ],
      columns: [{
        uniqueName: "Country"
      }],
      measures: [{
        uniqueName: "Price",
        aggregation: "sum"
      }]
    }
  }
});

function saveToServer() {
  flexmonster.save({
    filename: 'report.json',
    destination: 'server',
    url: 'https://httpstat.us/200',
    serverContentType: 'application/json',
    callbackHandler: reportSaved
  });
}

function reportSaved(result, error) {
  if (error) {
    console.log("response: " + error.response + "\nstatus: " + error.status + "\nmessage: " + error.message);
  } else {
    alert("Saved!")
  }
}

function customizeToolbar(toolbar) {
  let tabs = toolbar.getTabs();
  toolbar.getTabs = function() {
    let saveTab = tabs.find(tab => tab.id == "fm-tab-save");
    if (!saveTab) return tabs;
    saveTab.handler = saveToServer;
    return tabs;
  }
}