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>
  Try exporting to CSV using the "Export" tab
</h3>

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

JavaScript

const pivot = new Flexmonster({
  container: "#pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  toolbar: true,
  beforetoolbarcreated: customizeToolbar,
  report: {
    dataSource: {
      type: "json",
      data: getData()
    },
    options: {
      grid: {
        type: "flat",
        showGrandTotals: false
      }
    }
  }
});

function customizeToolbar(toolbar) {
  let tabs = toolbar.getTabs();
  toolbar.getTabs = function() {
    let exportTab = tabs.find(tab => tab.id == "fm-tab-export");
    if (!exportTab) return tabs;
    let exportToCSVTab = exportTab.menu.find(tab => tab.id == "fm-tab-export-csv");
    exportToCSVTab.handler = () => {
      this.pivot.exportTo("CSV", {
        alwaysEnclose: true
      });
    }
    return tabs;
  }
}


function getData() {
  return [{
    "Name": "CVE-2023-4863 \n libcurl",
    "Version": "1.8.23",
    "Fixed version": "0:8.0.1-1, \namzn2.0.1"
  }]

}