Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
8 | |
7 | |
2 | |
2 | |
2 |
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
4 |