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>
<h4>
Lines: <br>
10 - 40: slice configuration. <br>
41 - 46: specifying the default classic view and no default subtotals. <br>
47 - 58: setting the default numeric values formatting. <br>
59 - 65: specifying the custom name for the column total.
</h4>
<div id="pivot-container"></div>
JavaScript
var pivot = new Flexmonster({
container: "#pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
report: {
dataSource: {
dataSourceType: "json",
data: getData()
},
slice: {
rows: [
{
"uniqueName": "Reporting Entity Name"
},
{
"uniqueName": "Calculation Method"
},
{
"uniqueName": "Benefit ID"
}
],
columns: [
{
"uniqueName": "Year"
},
{
"uniqueName": "[Measures]"
}
],
measures: [
{
"uniqueName": "Amount",
"aggregation": "sum",
"format": "-k01q02bgnur00"
}
],
expands: {
"expandAll": true
}
},
options: {
grid: {
"type": "classic",
"showTotals": "off"
}
},
formats: [
{
"name": "",
"currencySymbol": ""
},
{
"name": "-k01q02bgnur00",
"thousandsSeparator": ",",
"decimalPlaces": 2,
"currencySymbol": "$"
}
],
localization: {
aggregations: {
sum: {
"grandTotalCaption": "Grand Total"
}
}
}
},
width: "100%",
height: 540
});
function getData() {
return [
{
"Year": 2019,
"Reporting Entity Name": "RE01",
"Calculation Method": "12 week register",
"Benefit ID": 3,
"Amount": 0.52
},
{
"Year": 2019,
"Reporting Entity Name": "RE01",
"Calculation Method": "12 week register",
"Benefit ID": 7,
"Amount": 0.52
},
{
"Year": 2019,
"Reporting Entity Name": "RE01",
"Calculation Method": "Statuary formula",
"Benefit ID": 1,
"Amount": 116.93
},
{
"Year": 2019,
"Reporting Entity Name": "RE01",
...