cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
gokulreva Occasional Visitor
Occasional Visitor

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