TEST
Flexmonster example to PDF
by lekhrajpanjwani
HTML
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<button onclick="pdf()">Export to PDF</button>
<div id="pivot-container">The component will appear here</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/",
toolbar: true,
height: 500,
report: {
dataSource: {
data: getData()
},
slice: {
rows: [
{uniqueName: "Color"}
],
columns: [
{uniqueName: "[Measures]"}
],
measures: [
{
uniqueName: "Price",
format: "currency"
},
{
uniqueName: "Quantity",
},
{uniqueName: "Quantity",},
{uniqueName: "AA",},
{uniqueName: "BB",},
{uniqueName: "CC",},
{uniqueName: "DD",},
{uniqueName: "EE",},
{uniqueName: "FF",},
{uniqueName: "GG",},
{uniqueName: "HH",},
{uniqueName: "II",},
{uniqueName: "JJ",},
{uniqueName: "KK",},
{uniqueName: "LL",},
{uniqueName: "MM",},
{uniqueName: "NN",},
]
},
options: {
viewType: "flat",
grandTotalsPosition: "bottom",
grid: {
type: "flat"
},
},
formats: [
{
"name": "",
"thousandsSeparator": ",",
},
{
"name": "currency",
"thousandsSeparator": ",",
"decimalSeparator": ".",
"decimalPlaces": 2,
"currencySymbol": "$",
"currencySymbolAlign": "left",
"nullValue": "$0.00",
"textAlign": "right",
"isPercent": false
},
]
}
});
/* function pdf() {
var widgetName = "myWidget";
const posParams = {
filename: widgetName,
header: "<div style='text-align: center; width:100%; padding: 10px;'><h5>" +widgetName+"</h5></div>",
pageFormat:"A2",
...