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>

<button onclick="pdf()">Export to PDF</button>

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

JavaScript

let pivot = new Flexmonster({
  container: "pivot-container",
  height: "400px",
  componentFolder: "https://cdn.flexmonster.com/",
  reportcomplete: () => {
    pivot.expandAllData(true)
  },
  report: {
    dataSource: {
      filename: "data/data.csv"
    },
    slice: {
      columns: [{
        uniqueName: "[Measures]"
      }],
      measures: [{
        aggregation: "sum",
        uniqueName: "Price"
      }],
      rows: [{
        uniqueName: "Category"
      }, {
        uniqueName: "Color"
      }]
    }
  }
});



function pdf() {
  const params = {
    pageFormat: 'A0'
  };
  flexmonster.exportTo('pdf', params);
}