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>
<div id="pivot-container"></div>
JavaScript
var pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
beforetoolbarcreated: customizeToolbar,
report: {
dataSource: {
filename: "data/sales.csv"
},
slice: {
rows: [
{
uniqueName: "Region"
}
],
columns: [
{
uniqueName: "[Measures]"
},
{
uniqueName: "Salesperson"
}
],
measures: [
{
uniqueName: "Unit Price",
aggregation: "sum"
}
]
}
}
});
function customizeToolbar(toolbar) {
// get all tabs
var tabs = toolbar.getTabs();
toolbar.getTabs = function () {
console.log(tabs);
// change the save tab's behavior
tabs[2].handler = newtabHandler;
return tabs;
}
var newtabHandler = function() {
// add new functionality here
flexmonster.save({
filename: 'myreport.json',
destination: 'server',
url: 'https://yourserver.com/yourscript.php',
callbackHandler: 'reportSaved'
});
function reportSaved() {
alert("Saved!");
}
}
}