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="pivotContainer"></div>
JavaScript
let pivot = new Flexmonster({
container: "pivotContainer",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
report: {
dataSource: {
data: getData()
},
"slice": {
"rows": [{
"uniqueName": "Item"
}],
"columns": [{
"uniqueName": "[Measures]"
}],
"measures": [{
"uniqueName": "Price",
"aggregation": "sum",
"format": "float"
},
{
"uniqueName": "Quantity",
"aggregation": "sum",
"format": "integer"
}
]
},
"formats": [{
"name": "float",
"decimalPlaces": 2
},
{
"name": "integer",
"thousandsSeparator": ","
}
]
}
});
function getData() {
return [{
"Price": 354.23,
"Quantity": 34563,
"Item": "Item 1"
},
{
"Price": 5446.99,
"Quantity": 24364,
"Item": "Item 2"
},
{
"Price": 345.435,
"Quantity": 25473,
"Item": "Item 3"
}
]
}