如何在Powerbi客户端库中注册事件处理程序

时间:2019-05-27 14:14:20

标签: javascript reactjs event-handling powerbi

我将PowerBi报表嵌入到单页react-app中,我想利用可用的事件处理程序,但无法触发它们。

我尝试了几种不同的方法,包括嵌入报表的不同方法。我确保在注册新事件处理程序之前先删除所有现有的事件处理程序,但是没有任何效果。我也尝试了所有可用的事件,但没有一个触发。

/*
 * From the PowerBi documentation
*/
this.powerbi = new pbi.service.Service(pbi.factories.hpmFactory, pbi.factories.wpmpFactory, pbi.factories.routerFactory);
this.powerBiContainer = React.createRef();

let config = {...};

this.report = this.powerbi.embed(this.powerBiContainer.current, config);
this.report.off("loaded");
this.report.on("loaded", (e) => {
   console.log("loaded");
});

上面的代码是我应用程序中代码的精简但准确的表示形式。我希望在报表完成加载后将“已加载”打印到控制台,但是不会发生这种情况。我还尝试了其他事件,例如“ dataSelected”,但无济于事。

0 个答案:

没有答案