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>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700&amp;subset=cyrillic" rel="stylesheet">

<button class="normal-button" onclick="exportTo()">Export To Excel</button>
<button onclick="exportToWarning()">Export To Excel (Warning)</button>
<div id="pivot-container"></div>

CSS

/* ===== PIVOT UI ===== */
#fm-pivot-view .fm-ui,
#fm-pivot-view .fm-ui span,
#fm-pivot-view .fm-ui div,
#fm-pivot-view .fm-ui p,
#fm-pivot-view .fm-ui a,
#fm-pivot-view .fm-ui table,
#fm-pivot-view .fm-ui table th,
#fm-pivot-view .fm-ui table tr,
#fm-pivot-view .fm-ui table td,
#fm-pivot-view .fm-ui ul,
#fm-pivot-view .fm-ui li,
#fm-pivot-view .fm-ui input,
#fm-pivot-view .fm-ui textarea,
#fm-pivot-view .fm-ui select,
#fm-toolbar-wrapper .fm-toolbar-ui,
#fm-toolbar-wrapper .fm-toolbar-ui span,
#fm-toolbar-wrapper .fm-toolbar-ui div,
#fm-toolbar-wrapper .fm-toolbar-ui p,
#fm-toolbar-wrapper .fm-toolbar-ui a,
#fm-toolbar-wrapper .fm-toolbar-ui table,
#fm-toolbar-wrapper .fm-toolbar-ui table th,
#fm-toolbar-wrapper .fm-toolbar-ui table tr,
#fm-toolbar-wrapper .fm-toolbar-ui table td,
#fm-toolbar-wrapper .fm-toolbar-ui ul,
#fm-toolbar-wrapper .fm-toolbar-ui li,
#fm-toolbar-wrapper .fm-toolbar-ui input,
#fm-toolbar-wrapper .fm-toolbar-ui textarea,
#fm-toolbar-wrapper .fm-toolbar-ui select {
  font-family: Open Sans, sans-serif !important;
}

#fm-pivot-view .fm-helper {
  font-family: Open Sans, sans-serif !important;
}

#fm-toolbar-wrapper #fm-toolbar,
#fm-toolbar-wrapper #fm-toolbar div,
#fm-toolbar-wrapper #fm-toolbar span,
#fm-toolbar-wrapper #fm-toolbar p,
#fm-toolbar-wrapper #fm-toolbar a,
#fm-toolbar-wrapper #fm-toolbar table,
#fm-toolbar-wrapper #fm-toolbar table th,
#fm-toolbar-wrapper #fm-toolbar table tr,
#fm-toolbar-wrapper #fm-toolbar table td,
#fm-toolbar-wrapper #fm-toolbar ul,
#fm-toolbar-wrapper #fm-toolbar li,
#fm-toolbar-wrapper #fm-toolbar input,
#fm-toolbar-wrapper #fm-toolbar textarea,
#fm-toolbar-wrapper #fm-toolbar select {
  font-family: Open Sans, sans-serif !important;
}

/* POPUP WINDOW */
#fm-toolbar-wrapper div.fm-popup {
  font-family: Open Sans, sans-serif !important; 
}

/* GENERAL */
#fm-toolbar-wrapper div.fm-popup input[type=text],
#fm-toolbar-wrapper div.fm-popup input[type=number],
#fm-toolbar-wrapper div.fm-popup...

JavaScript

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

function exportToWarning(){
   var params = {
    filename: 'flexmonster',
    showFilters: true
  };
  flexmonster.exportTo('excel', params);
}

function exportTo(){
   var params = {
    filename: 'flexmonster'
  };
  flexmonster.exportTo('excel', params);
}

function getData() {
  return [{
    "Category": "Accessories",
    "Size": "262 oz",
    "Color": "red",
    "Destination": "Australia",
    "Business Type": "Specialty Bike Shop",
    "Country": "Australia",
    "Price": 174,
    "Quantity": 225,
    "Discount": 23
  }, {
    "Category": "Accessories",
    "Size": "214 oz",
    "Color": "yellow",
    "Destination": "Canada",
    "Business Type": "Specialty Bike Shop",
    "Country": "Canada",
    "Price": 502,
    "Quantity": 90,
    "Discount": 17
  }, {
    "Category": "Components",
    "Size": "235 oz",
    "Color": "green",
    "Destination": "Australia",
    "Business Type": "Warehouse",
    "Country": "Australia",
    "Price": 551,
    "Quantity": 1950,
    "Discount": 51
  }, {
    "Category": "Components",
    "Size": "307 oz",
    "Color": "white",
    "Destination": "United Kingdom",
    "Business Type": "Warehouse",
    "Country": "Canada",
    "Price": 842,
    "Quantity": 8212,
    "Discount": 55
  }, {
    "Category": "Bikes",
    "Size": "334 oz",
    "Color": "red",
    "Destination": "United States",
    "Business Type": "Value Added Reseller",
    "Country": "Canada",
   ...