JSFiddle - React, Tailwind, and code Playground
Events
by Flexmonster Pivot Table
January 30, 2026
HTML
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<p>
After the grid or chart is rendered, the <code>reportcomplete</code> event is
triggered and 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;
}
showOutput("Component initialized!");
showOutput(JSON.stringify(pivot.getOptions()));
pivot.on("reportcomplete", function () {
showOutput("Report completed!");
showOutput(JSON.stringify(pivot.getOptions()));
});
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,
},
];
}