cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Zuv Frequent Visitor
Frequent Visitor

Replace powerbi report on same div with a new one

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

 

5 REPLIES 5
ndothanh Occasional Visitor
Occasional Visitor

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

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.

gicagugui Visitor
Visitor

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.

brianl Visitor
Visitor

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);
}
DanT Frequent Visitor
Frequent Visitor

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

Having the same issue here.  This error came after 'powerbi.reset' and try to reload a new report "powerbi.embed(X,Y)". Nothing seems to be affected. But is this a bug? Will it bring bad effects?

stizz001 Regular Visitor
Regular Visitor

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

I am getting the same issue and where it is affecting me is when I try to turn the report's edit mode on.  The report rendered fine and looks all correct, but I give SysAdmin's the ability to edit the report directly in my app, and when I hit that button, I get the same error.  

 

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

Can anyone help, please? Thanks.