JSFiddle - React, Tailwind, and code Playground

by Flexmonster Pivot Table

HTML

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

<button onclick="save()">
SAVE DATA</button>

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

JavaScript

let pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  toolbar: true,
  beforetoolbarcreated: customizeToolbar,
  report: {
    dataSource: {
      filename: "https://cdn.flexmonster.com/data/data.csv",
    }
  }
});

function customizeToolbar(toolbar) {
  let tabs = toolbar.getTabs();
  toolbar.getTabs = function() {

    tabs = tabs.map(tab => {
      if (tab.id === "fm-tab-save") {
        tab.handler = save
      }
      return tab;
    })
    
    return tabs;
  }
}

function save() {
  pivot.save({
    embedData: true
  });
}