Forum Discussion

Pitchaimuthu's avatar
Pitchaimuthu
Helper II
9 years ago

how to handle the power bi embedded tile action using javascript?

I have embedded Power BI tile into web application using javascript. Tile loaded perfectly but when we click on the tile nothing happen in the tile. I need when the user click on the tile it should show like clicked bar only active others should be inactive mode.

Please give how to do this. here below is my code.

var width = 800;
var height = 600;
var embedTileUrl = "https://app.powerbi.com/embed?dashboardId=a36a459767f437-c8cc539ce78e&tileId=f541e144-4sdsd389e-bc03-2f80b9b7076d";

window.onload = function () {
updateEmbedTile();
};

function updateEmbedTile() {
if ("" === embedTileUrl)
return;
iframe = document.getElementById('iFrameEmbedTile');
iframe.src=embedTileUrl + "&width=" + width + "&height=" + height;
iframe.onload = postActionLoadTile;
}

function postActionLoadTile() {
 var accessToken = 'eMNksdOnasdfCJhbGciOiJSUzI1NiIsIng1dCI6ImEzUU4wQlpTN3M0bk4tQmRyam..............................................;
if ("" === accessToken)
return;
var h = height;
var w = width;
var m = { action: "loadTile", accessToken: accessToken, height: h, width: w };
message = JSON.stringify(m);
iframe = document.getElementById('iFrameEmbedTile');
iframe.contentWindow.postMessage(message, "*");
}

 

<body>
<div>
<iframe id="iFrameEmbedTile" src="" height="900" width="900" frameborder="0" seamless></iframe>
</div>
</body>

6 Replies

  • Eric_Zhang's avatar
    Eric_Zhang
    Microsoft Employee

    Pitchaimuthu wrote:

    I have embedded Power BI tile into web application using javascript. Tile loaded perfectly but when we click on the tile nothing happen in the tile. I need when the user click on the tile it should show like clicked bar only active others should be inactive mode.


    Pitchaimuthu

    It is by design that the tiles don't have interaction as you described. You can check this idea Interactive dashboard tiles and vote it up.

     

    The workaround can be embedding a dashboard with live page or embedding a report instead.

    • Pitchaimuthu's avatar
      Pitchaimuthu
      Helper II

      Thank you Eric_Zhang. could you help me? I have facing one more issues in Power BI embedded. I have embedded Power BI Report, but when I execute the application in IE browser that the drill down option does not shown in IE, but others browser showing the drill down option in report.

      • Eric_Zhang's avatar
        Eric_Zhang
        Microsoft Employee

        Pitchaimuthu wrote:

        Thank you Eric_Zhang. could you help me? I have facing one more issues in Power BI embedded. I have embedded Power BI Report, but when I execute the application in IE browser that the drill down option does not shown in IE, but others browser showing the drill down option in report.


        Pitchaimuthu

        Could you be more specific on the visual? Or perhaps you can provide the pbix to help reproduce the issue? Once the issue identifed, I'll escalate it to the product team.