Reply
Highlighted
Zuv Frequent Visitor
Frequent Visitor
Posts: 13
Registered: ‎04-26-2016

Replace powerbi report on same div with a new one

[ Edited ]

We do have application where user can select from a few reports and load them over ajax on a same reportContainer div.

We have been using powerbi js for quite a long time, it was version -- v2.4.7

It worked pretty well, stable, fast and the most important it could use same created iFrame for a new report without reloading it from scratch.

Here is the code that worked:

var config = {
          type: 'report',
          tokenType: models.TokenType.Embed,
          accessToken: embedToken,
          embedUrl: embedUrl,
          id: report_id
};
powerbi.embed(reportContainer,config);

Recently we started Powerbi js version -- v2.6.5

It basically can't use same div container, in order to place a new report I need to reset it first with:

powerbi.reset(reportContainer); 
OR
powerbi.embedNew(reportContainer, config);

Well, it works, but it takes time to load all the frame every time and it looks much slower compared with old version of Powerbi JS.

Also I am having this error on Javascript level when doing powerbi.reset(reportContainer):

Error: target window is not provided.  You must either provide the target window explicitly as argument to request, or specify default target window when constructing instance of this class.

Maybe this is something that down the speed?

Is it possible to make it faster? Or maybe mine modus operandi is not the good one and I should use something different?
Many thanks

 

Occasional Visitor
Posts: 1
Registered: ‎11-02-2018

Re: Replace powerbi report on same div with a new one

[ Edited ]

I also meet the same issue, and the error happens when embedding new report, it happens in the handler for front load 'ready' message.

I concern that whether this error is harmful or not.

Visitor
Posts: 1
Registered: ‎11-29-2018

Re: Replace powerbi report on same div with a new one

We face the same issue when using reset or embedNew to replace the report in a div container. 

Is this a bug or the approach we followed is not the correct one? Thanks.

Visitor
Posts: 2
Registered: ‎03-16-2018

Re: Replace powerbi report on same div with a new one

I have the some problem with 2.6.5. I was able to go back just one version, to 2.6.4, in order to avoid the error. I did not notice a performance difference between the two versions.

 

Here is how I am switching out the report.

 

let config = {
    type: "report",
    tokenType: pbi.models.TokenType.Embed,
    accessToken: accessToken,
    embedUrl: embedUrl,
    id: reportId,
    permissions: pbi.models.Permissions.All,
    viewMode: pbi.models.ViewMode.View,
    pageView: 'fitToWidth',
    settings: {
        filterPaneEnabled: false,
        navContentPaneEnabled: true
    }
};
let embedDiv = document.getElementById('embedDiv');
if (embedDiv !== null) {
    powerbi.reset(embedDiv);
    let embeddedReport = powerbi.embed(embedDiv, config);
}