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>
<button onclick="csv()">Export to CSV</button>
<div id="pivot-container"></div>
JavaScript
var pivot = new Flexmonster({
container: "#pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
height: 430,
toolbar: true,
report: {
dataSource: {
data: getData()
},
formats: [{
name: "",
thousandsSeparator: ","
},
]
},
});
function csv() {
var params = {
filename: 'flexmonster',
showFilters: true
};
flexmonster.exportTo('csv', params);
}
function getData() {
return [{
"Category": "Cars",
"Price": 127000.005
},
{
"Category": "Bikes",
"Price": 123456789
}
];
}