Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi All,
I am trying to extend the embedded dashboard to support drill through using "tileClicked" event but I am getting "TileClickError" whenever I am clicking the dashboard.
Below is the code I am using
<script>
// Read embed application token from Model
var accessToken = "@Model.EmbedToken.Token";
// Read embed URL from Model
var embedUrl = "@Html.Raw(Model.EmbedUrl)";
// Read dashboard Id from Model
var embedDashboardId = "@Model.Id";
// Get models. models contains enums that can be used.
var models = window['powerbi-client'].models;
// Embed configuration used to describe the what and how to embed.
// This object is used when calling powerbi.embed.
// This also includes settings and options such as filters.
// You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
var config = {
type: 'dashboard',
tokenType: models.TokenType.Embed,
accessToken: accessToken,
embedUrl: embedUrl,
id: embedDashboardId,
pageView: 'fitToWidth'
};
// Get a reference to the embedded dashboard HTML element
var dashboardContainer = $('#dashboardContainer')[0];
// Embed the dashboard and display it within the div container.
var dashboard = powerbi.embed(dashboardContainer, config);
// Dashboard.off removes a given event handler if it exists.
dashboard.off("loaded");
// Dashboard.on will add an event handler which prints to Log window.
dashboard.on("loaded", function () {
console.log("Loaded");
});
dashboard.on("error", function (event) {
// alert(JSON.stringfy(event.detail));
console.log(event.detail);
dashboard.off("error");
});
dashboard.off("tileClicked");
dashboard.on("tileClicked", function (event) {
alert("Inside titleclicked");
console.log(event);
});
</script>
Thanks in advance for your help.
Regards,
Gokul
You are trying to access elements inside an iframe. It is rendered from a different domain and that's not allowed from javascript. This is probably why you are getting the error.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 3 | |
| 3 | |
| 2 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 11 | |
| 7 | |
| 4 | |
| 3 | |
| 3 |