JSFiddle - React, Tailwind, and code Playground
Data source
by Flexmonster Pivot Table
HTML
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<div id="pivot-container"></div>
JavaScript
const pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
width: "100%",
height: 300,
cellclick: getId,
report: {
dataSource: {
data: getData(),
mapping: {
"Category": {
type: "string"
},
"Price": {
type: "number"
},
"RowId": {
type: "id"
}
}
}
}
});
function getId(cell) {
alert(cell.recordId)
}
function getData() {
return [
{
"Category": "Accessories",
"Price": 242,
"RowId": 1
},
{
"Category": "Bikes",
"Price": 1487,
"RowId": 2
},
{
"Category": "Clothing",
"Price": 40,
"RowId": 3
}
]
}