<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<p>
Change something in the current report (e.g., update the data slice or apply
filtering) to trigger the <code>update</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>
const pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
height: 340,
report: {
dataSource: {
filename: "data/data.json"
}
}
});
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 alert you should change something in the component.
For example, update data slice or apply filtering. */
pivot.on('update', function () {
showOutput('Updated!');
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.