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="exportPDFTitle()">Export PDF with a title</button>
<div id="pivot-container"></div>

JavaScript

var pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  width: "100%",
  height: 730,
  toolbar: true,
  report: {
    dataSource: {
      type: "json",
      filename: "https://cdn.flexmonster.com/data/data.json"
    },
    "options": {
      "grid": {
        "type": "flat",
        "showTotals": "off",
        "showGrandTotals": "off"
      },
      "datePattern": "dd-MM-yyyy"
    },
  }
});

function exportPDFTitle() {
  var options = flexmonster.getOptions();
  flexmonster.setOptions({
    grid: {
      title: 'Test PDF Header'
    }
  });
  flexmonster.refresh();
  flexmonster.exportTo('pdf', {
    pageFormat: 'a2'
  });
  flexmonster.on('exportcomplete', function() {
    flexmonster.off('exportcomplete')
    flexmonster.setOptions(options);
    flexmonster.refresh();
  });
}