JSFiddle - React, Tailwind, and code Playground
by Flexmonster Pivot Table
HTML
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<div id="pivotContainer">The component will appear here</div>
JavaScript
let pivot = new Flexmonster({
container: "pivotContainer",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
report: {
"dataSource": {
"type": "json",
"filename": "data/retail-data.json"
},
"slice": {
"rows": [{
"uniqueName": "Country"
}],
"columns": [{
"uniqueName": "[Measures]"
}],
"measures": [{
"uniqueName": "Price",
"aggregation": "sum"
},
{
"uniqueName": "Formula #1",
"formula": "if( sum(\"Price\") >= sum(\"Quantity\") , 0, 1)",
"caption": "Formula #1",
"format": "decimalFormat"
},
{
"uniqueName": "Formula #2",
"formula": "sum(\"Price\") / 2",
"caption": "Formula #2"
}
]
},
"formats": [{
"name": "decimalFormat",
"decimalPlaces": 0
}],
}
});