Menu
Download Free Trial
Table of contents

getReport

getReport(options:Object):ReportObject

[starting from version: 1.4]

Returns Report Object which describes the current report. Use this object to save or edit report at runtime.

Parameters

options (optional) – Object. Can contain the following properties:

  • withDefaults (optional) – Boolean. Indicates whether the default values for options will be included in the report (true) of not (false). The default value is false.
  • withGlobals (optional) – Boolean. Indicates whether the options defined in global object will be included in the report (true) of not (false). The default value is false.

Example

1) Get 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",
	report: {
		dataSource: {
			filename: "http://cdn.flexmonster.com/2.3/data/data.csv"
		}
	}
});
</script>

<button onclick="getReport()">Get Report</button>
<script>
	function getReport() {
		console.log(pivot.getReport());
	}
</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>

Try on JSFiddle.

3) Get report with defaults or globals: JSFiddle.

See also

setReport
Report Object
open
load
save