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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not 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!

0 REPLIES 0

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.