Forum Discussion
Anonymous
7 years agoNot applicable
Replace embeded dashboard with report after tile clicked
Hello all,
I am sorry if there is another question on this I couldn't find.
My aim is to initially embed a dashboard into container.
Then when a tile is clicked I would like to replace the dashboard , in the current page,with the report.
I managed to extract the report id from the clicked tile and create a new config.
Then I reset the current element, the one with the embedded dashboard.
However, when I try to embed again with the new config nothing appears on the screen.
The tileClicked code is:
dashboard.on("tileClicked", function (event) {
var clickedTile = event.detail.tileId;
if (clickedTile = 'TILE ID') {
//window.open('EmbedReport', '_blank');
var url = new URL(event.detail.reportEmbedUrl);
var c = url.searchParams.get("reportId");
// Read embed application token from Model
var accessToken2 = "@Model.EmbedToken.Token";
// Read embed URL from Model
var embedUrl2 = "@Html.Raw(Model.EmbedUrl)";
var models2 = window['powerbi-client'].models;
var config2 = {
type: 'report',
tokenType: models2.TokenType.Embed,
accessToken: accessToken2,
embedUrl: embedUrl2,
id: c,
permissions: models2.Permissions.All,
settings: {
filterPaneEnabled: true,
navContentPaneEnabled: true
}
};
powerbi.reset(dashboardContainer);
var reportEmbed = powerbi.embed(dashboardContainer, config2);
}
});Thank you in advance!
No Replies