JSFiddle - React, Tailwind, and code Playground
by Flexmonster Pivot Table
HTML
<link rel="stylesheet" href="https://cdn.flexmonster.com/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<button id="btn" onclick="emptyData()">Update data: empty JSON</button>
<button id="btn" onclick="updateData()">Update data: JSON</button>
<div id="pivot-container"></div>
JavaScript
var pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
width: "100%",
height: 430,
report: {
dataSource: {
data: getData()
}
}
});
function emptyData() {
var dataForUpdate = [{}];
flexmonster.updateData({data: dataForUpdate});
}
function updateData() {
var dataForUpdate = getData();
flexmonster.updateData({data: dataForUpdate});
}
function getData() {
return [
{
"Category": { "type": "string" },
"Price": { "type": "number" },
"RowId": { "type": "id" },
"DeleteRow": { "type": "delete" }
},
{
"Category": "Accessories",
"Price": 242,
"RowId": 1
},
{
"Category": "Bikes",
"Price": 1487,
"RowId": 2
},
{
"Category": "Clothing",
"Price": 40,
"RowId": 3
}
]
}