
Hi All,
I am getting the below error when i try to use Power BI JS to hide some pages and filters of power bi report in power app portals.
The report is displaying perfectly but the javascript is not working and giving error in console.
Uncaught Error: You attempted to get an instance of powerbi component associated with element
title="Power BI report"></iframe> but there was no associated instance.
Below is my code
{% assign forums_sm = sitemarkers["Forums"] %}
<html>
<script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/powerbi-client/dist/powerbi.js"></script>
<script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/jquery/dist/jquery.js"></script>
{% powerbi authentication_type:"AAD" path:"MyPowerBIURL" %}
</html>
<script>
$(window).load(function() {
// get div container for powerbi report
var embedContainer = $(".powerbi")[0];
// get reference to the embedded report
var report = powerbi.get(embedContainer);
// register a function to execute when report will finish loading
report.on("loaded", function(){
// update existing setting of the reports
// you can disable only one page or both at the same time
report.updateSettings({
panes: {
filters :{
visible: false
},
pageNavigation:{
visible: false
}
}
}).catch(function (errors) {
console.log(errors);
});
})
});
</script>
Please help how i can get ride of this error.
I exactly followed same steps mentioned in msdn link. Please see link here
https://docs.microsoft.com/en-us/powerapps/maker/portals/admin/add-powerbi-report
Thank you
Hi,
Please refer to the following documentation.
Embed a report in a secure portal or website - Power BI | Microsoft Docs