Update data - scroll
by inunziante
HTML
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<button onclick="updateData()">Update data </button>
<div id="pivot-container"></div>
JavaScript
const jsonData = [
{
Category: "Accessories",
Size: "277 oz",
Color: "red",
Destination: "United Kingdom",
"Business Type": "Warehouse",
Country: "United Kingdom",
Price: 1000,
Quantity: 730,
Discount: 38,
},
{
Category: "Accessories",
Size: "47 oz",
Color: "white",
Destination: "United States",
"Business Type": "Warehouse",
Country: "United States",
Price: 7941,
Quantity: 73,
Discount: 53,
},
{
Category: "Bikes",
Size: "264 oz",
Color: "white",
Destination: "Australia",
"Business Type": "Specialty Bike Shop",
Country: "Australia",
Price: 6829,
Quantity: 19,
Discount: 56,
},
];
const jsonData2 = [
{
Category: "Accessories",
Size: "277 oz",
Color: "red",
Destination: "United Kingdom",
"Business Type": "Warehouse",
Country: "United Kingdom",
Price: 10000,
Quantity: 7300,
Discount: 380,
},
{
Category: "Accessories",
Size: "47 oz",
Color: "white",
Destination: "United States",
"Business Type": "Warehouse",
Country: "United States",
Price: 79410,
Quantity: 70,
Discount: 530,
},
{
Category: "Bikes",
Size: "264 oz",
Color: "white",
Destination: "Australia",
"Business Type": "Specialty Bike Shop",
Country: "Australia",
Price: 68290,
Quantity: 190,
Discount: 560,
},
];
const pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
report: {
dataSource: {
data: jsonData,
},
slice: {
rows: [
{ uniqueName: "Country" }],
columns: [
{ uniqueName: "Destination" },
{ uniqueName: "[Measures]" }],
measures: [
{ uniqueName: "Price" },
{ uniqueName: "Quantity" },
{ uniqueName: "Discount" }
],
...