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.
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
In case you still are having this issue I found that in my code the part that loaded the report was being run 2 times. The first time everything works great. The 2nd time is when the contentWindow was not there and thus threw the error message. So I put an "if" statement around the code that loads the report that will only pass if.....
report && report.iframe && report.iframe.contentWindow
so if you wrap your report loading code in an if statment like this, that will get rid of the error message.
//get the report container and the report from the container for further use var $reportContainer = $('#reportEmbed'); report = powerbi.embed($reportContainer.get(0), self.embedConfig); //when the report is loaded report.on('loaded', function (event) { if (report && report.iframe && report.iframe.contentWindow) { report.getPages().then(function (pages) { if (pages) { pages[0].setActive(); } }); report.on('rendered', function (_) { $('#reportEmbed').css('opacity', '100'); }); } });
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?
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.
same here
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); }
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.
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
12 | |
2 | |
1 | |
1 | |
1 |