JSFiddle - React, Tailwind, and code Playground
Configuring the report
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="saveReport()">Save report without data source</button>
<div id="pivot-container"></div>
JavaScript
var pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
width: "100%",
height: 430,
report: {
dataSource: {
filename: "data/data.json",
},
},
})
function download(content, fileName, contentType) {
var a = document.createElement("a")
var file = new Blob([content], { type: contentType })
a.href = URL.createObjectURL(file)
a.download = fileName
a.click()
}
function saveReport() {
let report = pivot.getReport();
delete report.dataSource;
const jsonString = JSON.stringify(report, null, 2);
download(jsonString, "report.json", "application/json");
}