JSFiddle - React, Tailwind, and code Playground
by lekhrajpanjwani
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="pdf()">Export to PDF</button>
<div id="pivot-container"></div>
CSS
/* .fm-cell.fm-grand-total {
background-color: rgba(128, 194, 242, 0.5) !important;
} */
JavaScript
var pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
width: "100%",
height: 430,
toolbar: true,
report: {
dataSource: {
data: getData()
},
options: {
viewType: "grid",
grid: {
type: "flat",
"showTotals": "off",
"showGrandTotals": "on",
"showFilter": false,
"showReportFiltersArea": false,
"showAllLabels": false,
"grandTotalsPosition": "bottom"
}
}
}
});
function pdf() {
var widgetName = "myWidget";
const posParams = {
filename: widgetName,
header: "<div style='text-align: center; width:100%; padding: 10px;'><h5>" +widgetName+"</h5></div>",
pageOrientation: "landscape",
pageFormat: "A2"
};
flexmonster.exportTo('pdf', posParams);
}
function getData() {
return [
{
"_id": "5db94d122c3e9a3c39566412",
"index": 0,
"guid": "c0790dc5-5974-4fd7-992d-86f30778a9bb",
"isActive": true,
"isPresent": true,
"isOutdated": true,
"isBroken": false,
"balance": "$1,473.37",
"age": 35,
"quantity": 28,
"dublicates": 24,
"eyeColor": "blue",
"name": "Cantrell Manning",
"gender": "male",
"company": "SPACEWAX",
"email": "[email protected]",
"phone": "+1 (918) 424-2926",
"address": "931 Vermont Street, Starks, West Virginia, 8799",
"registered": "2014-04-27T05:10:15 -03:00",
"latitude": -11.492421,
"longitude": 135.752886
},
{
"_id": "5db94d12015e97c5863f0ecd",
"index": 1,
"guid": "fd7f5700-04b4-430f-b1ca-e05d7c331a80",
"isActive": false,
"isPresent": true,
"isOutdated": false,
"isBroken": true,
"balance": "$1,800.70",
"age": 29,
"quantity": 22,
"dublicates": 32,
"eyeColor": "brown",
"name": "Deanna Dunlap",
"gender": "female",
"company": "KOZGENE",
"email": "[email protected]",
"phone":...