Menu
Download Free Trial
Table of contents

setReport

setReport(report:ReportObject | String)

[starting from version: 1.4]

Sets a report to be displayed in the component. Use this method to load and show previously saved reports.

Parameters

Report Object which describes the report and contains all its properties. XML reports are also supported in terms of backward compatibility.

Example

1) Set report:

<div id="pivotContainer">The component will appear here</div> 
<script src="flexmonster/lib/jquery.min.js"></script>
<script src="flexmonster/flexmonster.js"></script>
<script>
var pivot = $("#pivotContainer").flexmonster({
	licenseKey: "XXXX-XXXX-XXXX-XXXX-XXXX"
});

</script>

<button onclick="setReport()">Set Report</button>
<script>
	function setReport() {
		var report = {
		  	dataSource: {
		    	filename: "http://cdn.flexmonster.com/2.3/data/data.csv"
		    },
		    options: {
		    	configuratorActive: false
		    }
		}
		pivot.setReport(report);
	}
</script>

Open the example on JSFiddle.

2) Swap two reports:

<div id="firstPivotContainer">The component will appear here</div> 
<div id="secondPivotContainer">The component will appear here</div> 
<script src="flexmonster/lib/jquery.min.js"></script>
<script src="flexmonster/flexmonster.js"></script>
<script">
var pivot1 = $("#firstPivotContainer").flexmonster({
	toolbar: true,
	report: {
		dataSource: {
			filename: "data1.csv"
		}
	},
	licenseKey: "XXXX-XXXX-XXXX-XXXX-XXXX"
});
var pivot2 = $("#secondPivotContainer").flexmonster({
	toolbar: true,
	report: {
		dataSource: {
			filename: "data2.csv"
		}
	},
	licenseKey: "XXXX-XXXX-XXXX-XXXX-XXXX"
});
</script>

<button onclick="javascript: swapReports()">Swap Reports</button>
<script>
  function swapReports() {
    var report1 = pivot1.getReport();
    var report2 = pivot2.getReport();

    pivot1.setReport(report2);
    pivot2.setReport(report1);
  }
</script>

Open on JSFiddle.

See also

getReport
Report Object
open
load
save