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="rerunReport()">Rerun Report</button>
<div id="pivot-container"></div>
JavaScript
let slice = {
rows: [{
uniqueName: "Color"
},
{
uniqueName: "[Measures]"
}
],
columns: [{
uniqueName: "Country"
}],
measures: [{
uniqueName: "Price"
}],
expands: {
expandAll: true,
},
drills: {
drillAll: true,
},
};
let pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
report: {
dataSource: {
type: "api",
url: "https://olap.flexmonster.com:9500",
index: "fm-product-sales"
},
slice: slice,
}
});
function rerunReport() {
slice.columns.push({"uniqueName":"Category"})
pivot.runQuery(slice);
console.log("slice is renewed")
}