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="pivotContainer1"></div>
<button onclick="updateData()">
Update data
</button>
<div id="pivotContainer2"></div>
CSS
#pivotContainer1 {
margin-bottom: 30px;
}
JavaScript
let pivot1 = new Flexmonster({
container: "pivotContainer1",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
height: 370,
report: {
dataSource: {
data: getData()
}
}
});
let pivot2 = new Flexmonster({
container: "pivotContainer2",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
height: 370
});
function updateData() {
pivot2.updateData({
data: getDataUpdated()
});
}
function getData() {
return [{
"Category": "Accessories",
"Size": "262 oz",
"Color": "red",
"Destination": "Australia",
"Business Type": "Specialty Bike Shop",
"Country": "Australia",
"Price": 174,
"Quantity": 225,
"Discount": 23
}, {
"Category": "Cars",
"Size": "219 oz",
"Color": "white",
"Destination": "Germany",
"Business Type": "Warehouse",
"Country": "United States",
"Price": 29428,
"Quantity": 42,
"Discount": 36
},
{
"Category": "Components",
"Size": "75 oz",
"Color": "blue",
"Destination": "France",
"Business Type": "Value Added Reseller",
"Country": "United Kingdom",
"Price": 999,
"Quantity": 6023,
"Discount": 28
}
]
}
function getDataUpdated() {
return [{
"Category": "Bikes",
"Size": "226 oz",
"Color": "blue",
"Destination": "France",
"Business Type": "Warehouse",
"Country": "Canada",
"Price": 699,
"Quantity": 22,
"Discount": 42
}, {
"Category": "Clothing",
"Size": "218 oz",
"Color": "yellow",
"Destination": "Canada",
"Business Type": "Specialty Bike Shop",
"Country": "Australia",
"Price": 865,
"Quantity": 4513,
"Discount": 70
},
{
"Category": "Components",
"Size": "150 oz",
"Color": "blue",
"Destination": "United Kingdom",
"Business Type": "Value Added Reseller",
"Country": "France",
...