I have a report that contains more than 1 pages. Now I want to add a functionality in my report such that whenever I switch to some other page then I get to know the page name so that I can assign my page name value to some global variable
I have a report that contains more than 1 pages. Now I want to add a functionality in my report such that whenever I switch to some other page then I get to know the page name so that I can assign my page name value to some global variable
You can add an event handler which will get called when the Report page is changed.
Please follow the below code snippets:
embed configuration object for the report:const embedConfig = {
type: "report",
tokenType: models.TokenType.AAD,
accessToken: "ACCESS_TOKEN",
embedUrl: "EMBED_URL",
};
const embedContainer = $('#embedContainer')[0];
Report:const report = powerbi.embed(embedContainer, embedConfig);
event handler on the report object. Inside the event, you can assign the name property of the event object to the global variable:report.on('pageChanged', event => {
const page = event.details.newPage;
globalVar = page.name;
});
Please refer: https://docs.microsoft.com/javascript/api/overview/powerbi/page-navigation