We’re embedding the powerbi report using “powerbi-client”. Here is the application code we’re using to Embed the report.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/powerbi.min.js"></script>
</head>
<body>
<h1>PowerBI Embedded Sample</h1>
<div id="embedContainer" style="height: 80vh;"></div>
</body>
<script>
var config = {
type: "report",
tokenType: 0,
accessToken: '',
embedUrl: '',
id: '',
permissions: 7,
settings: {
filterPaneEnabled: true,
navContentPaneEnabled: true,
visualRenderedEvents: true
}
}
report = powerbi.embed(embedContainer, config);
// report.off removes all event handlers for a specific event
report.off("loaded");
report.off("rendered");
// report.on will add an event handler
report.on("loaded", function () {
console.log("loaded")
report.off("loaded");
});
// report.off removes all event handlers for a specific event
report.off("error");
report.on("error", function (event) {
console.log(event.detail);
});
// report.on will add an event handler
let i = 0;
report.on("rendered", function () {
// renderedResolve();
console.log("Rendered event", i++, " ", Date.now());
});
report.on("visualRendered",async ()=>{
console.log("Visual rendered");
})
}
embedPowerBIReport();
</script>
</html>
When the report gets embedded we’re getting the rendered event triggered twice.Does the rendered event should be triggered once all the visual rendered ? We’re expecting this behavior only when embedding report using vanila javascript.
When we use the same code in Developer sandbox we’re not experiencing this issue.We used the sample Report from doc.
Here is the snapshot where we’re getting rendered event calling twice in console log.
Sanspsot
Could any please look into this and help us to figure out why the rendered event is getting triggered twice. We’re expecting that rendered event should trigger only once when all the visuals are rendered.
Tarun Venkat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.