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
let pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
report: {
dataSource: {
data: getData(),
mapping: {
"month": {
type: "number",
},
}
},
slice: {
columns: [{
uniqueName: "[Measures]"
}],
measures: [{
uniqueName: "month",
format: "decimal0",
}],
flatSort: [{
uniqueName: "month",
sort: "asc"
}],
},
options: {
grid: {
type: "flat"
}
},
formats: [{
name: "decimal0",
decimalPlaces: 0,
}],
}
});
function getData() {
return [{
month: 1
},
{
month: 10
},
{
month: 12
},
{
month: 2
}
]
}