【发布时间】:2020-11-26 13:51:36
【问题描述】:
我的报告中有 4 页。我需要根据客户当前正在查看的网站显示不同的页面。最初,我有 4 种不同的配置来加载报告 4 次。当然,这对性能有很大影响,根本不是正确的解决方案。
一开始我试过这个
var report = powerbi.embed($reportContainer.get(0), embedConfigurationMain);
report.setFilters([basicFilterMain, stocktakeIdFilterMain]);
var page = report.page('ReportSectionxxxxxxxxx');
page.setActive();
但它仍然显示报表的默认页面。
然后我在https://community.powerbi.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/93716#M.. 找到了有类似问题的人。并尝试了建议的解决方案,但出现以下错误:
Uncaught TypeError: Cannot read property 'setActive' of undefined
然后我继续检查 Power BI Playground 并使用他们在那里提供的确切代码,即
report.getPages()
.then(function (pages) {
pages[0].setActive()
.then(function () {
Log.logText("Active page was set to: \"" + pages[0].displayName + "\"");
})
.catch(function (errors) {
Log.log(errors);
});
})
.catch(function (errors) {
Log.log(errors);
});
但仍然没有喜悦,什么也没有发生。甚至没有在控制台中收到消息。
在 JavaScript API 中设置活动报告页面的正确方法是什么?我正在使用最新版本的 Power BI Embedded SDK。
【问题讨论】:
标签: powerbi