Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
gokulreva
New Member

PowerBi Embedded Dashboard - title click event issue

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 

1 REPLY 1
ELNINO
New Member

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.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.