reportchange
Events
by Flexmonster Pivot Table
November 28, 2025
HTML
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<p>
Change the report (e.g., apply any sorting or filtering) to trigger the
<code>reportchange</code> event that outputs the message under the component.
</p>
<div id="pivot-container">The component will appear here</div>
<div class="output" id="output">Output will appear here</div>
CSS
@import url(https://cdn.flexmonster.com/assets/jsfiddle-styles.css);
JavaScript
var pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
height: 340,
report: {
dataSource: {
data: getData()
}
}
});
let outputInitialized = false;
function showOutput(content) {
var log = "[" + (new Date()).toLocaleTimeString('en-US') + "] " + content;
var outputElement = document.getElementById("output");
if (!outputInitialized) {
outputElement.innerText = '';
outputInitialized = true;
}
outputElement.innerText += log + "\n";
outputElement.scrollTop = outputElement.scrollHeight;
}
/* To see the output you should change the report.
For example, apply any sorting or filtering. */
pivot.on('reportchange', function () {
showOutput('Report changed!');
});
function getData() {
return [{
"Color": "green",
"M": "September",
"W": "Wed",
"country": "Canada",
"state": "Ontario",
"city": "Toronto",
"Price": 174,
"Quantity": 22
}, {
"Color": "red",
"M": "March",
"W": "Mon",
"Time": "1000",
"country": "USA",
"state": "California",
"city": "Los Angeles",
"Price": 30,
"Quantity": 19
}];
}