Search code examples
dynamics-crmpowerbi-embeddedadxstudio-portals

Changes on Power bi report with javascript are not applying every time


I have embedded power bi report in Dynamics Portal.I am trying to update settings on the power bi report with java script but the changes are not applying every time. I could see changes are getting applied on the script some times and some times not.I could see script is executing every time(i have kept alert box when we executed the script).Is there any way where we can make sure settings applies on the power bi report every time.


Solution

  • https://github.com/Microsoft/PowerBI-JavaScript/wiki/Handling-Events

    Use the PowerBI event handler and dont apply changes to the report unless you know is fully loaded, rendered and available. To do this you can make sure of the Rednered event.

     var report = powerbi.embed(reportContainer, config);
    
        report.on("rendered", function(event) {
    // do stuff here like apply filters or whatever it is you want to do to manipulate the report