<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: set active page in report with JavaScript API. in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/330206#M9780</link>
    <description>&lt;P&gt;Resurrecting this old post, but I hit this myself, and found a reasonable solution. The pageName setting does work, but the value required is not the "display name" you see in PowerBI, but actually an internal section ID. You can get this value by accessing the report in the web version of PowerBI and examining the URL.&amp;nbsp;&lt;BR /&gt;Ex, for my report below, my groupID is b5801...a4f, my reportID is 634f...054b, and my pageName is ReportSection50033...a22c&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://dave.powerbi.com/groups/b5801af2-7111-4b4a-b3c2-603b49af7a4f/reports/634f02e3-0f39-4fcb-8936-4a07039c054b/ReportSection50033d06d5078875a22c" target="_blank"&gt;https://dave.powerbi.com/groups/b5801af2-7111-4b4a-b3c2-603b49af7a4f/reports/634f02e3-0f39-4fcb-8936-4a07039c054b/ReportSection50033d06d5078875a22c&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While a little ugly, this lets you skip a double page load - I was having trouble with your solution above, as it's dependent on the timing of the report load. I achieved a workable solution by putting the page setter in a report loaded event, but I didn't like the user experience, as the default page (whatever I happened to edit last) would have to load before the desired page would load. Using the direct method with the internal ReportSection{ID} worked a lot cleaner.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 29 Dec 2017 01:47:37 GMT</pubDate>
    <dc:creator>daweins</dc:creator>
    <dc:date>2017-12-29T01:47:37Z</dc:date>
    <item>
      <title>set active page in report with JavaScript API.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/93716#M3315</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two pages in my report. I want to set the second page as active page with api.&lt;/P&gt;&lt;P&gt;Tried doing it in embed config and also separately with the page name.But the second page is not set as active.&lt;/P&gt;&lt;P&gt;Any ideas.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var embedConfiguration = {&lt;BR /&gt;type: reportType,&lt;BR /&gt;id: reportId,&lt;BR /&gt;accessToken: accessToken,&lt;BR /&gt;embedUrl: embedUrl,&lt;BR /&gt;//pageName: pageName&lt;BR /&gt;};&lt;BR /&gt;var $reportContainer = $('#reportContainer');&lt;BR /&gt;var report = powerbi.embed($reportContainer.get(0), embedConfiguration);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;const page = report.page(pageName);&lt;BR /&gt;page.setActive();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2016 11:49:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/93716#M3315</guid>
      <dc:creator>skancharla</dc:creator>
      <dc:date>2016-11-24T11:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: set active page in report with JavaScript API.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/95128#M3355</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/17378"&gt;@skancharla﻿&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;A href="https://github.com/Microsoft/PowerBI-JavaScript/wiki/Page-Navigation" target="_self"&gt;The documentaion&lt;/A&gt;&amp;nbsp;introduces the feature as you did in your code, however&amp;nbsp;I'm not able to set a default page as well.&lt;BR /&gt;Based on my search, there's an &lt;A href="https://microsoft.github.io/PowerBI-JavaScript/demo/defaults.html" target="_self"&gt;online&amp;nbsp;demo&lt;/A&gt;, &amp;nbsp;which shows this feature actually working.&lt;BR /&gt;You can check what the demo does in the js file&lt;BR /&gt;&lt;A href="https://microsoft.github.io/PowerBI-JavaScript/demo/app/defaults.js" target="_self"&gt;https://microsoft.github.io/PowerBI-JavaScript/demo/app/defaults.js&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I'm researching on this and would share any update I get.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2016 09:04:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/95128#M3355</guid>
      <dc:creator>Eric_Zhang</dc:creator>
      <dc:date>2016-11-29T09:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: set active page in report with JavaScript API.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/96192#M3390</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/6971"&gt;@Eric_Zhang﻿&lt;/a&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to resolve this and set the page dynamically.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead of fetching the page using page name as mentioned in my intial post, I got an array of all the pages and then set whichever page needs to be active.This worked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My previous code:&lt;/P&gt;&lt;P&gt;const page = report.page(pageName);&lt;BR /&gt;page.setActive();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My current code:&lt;/P&gt;&lt;P&gt;var pages = [];&lt;/P&gt;&lt;P&gt;report.getPages().then(function (reportPages) {&lt;BR /&gt;pages = reportPages;&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;pages[1].setActive();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps someone visiting here for the same issue.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2016 07:49:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/96192#M3390</guid>
      <dc:creator>skancharla</dc:creator>
      <dc:date>2016-12-01T07:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: set active page in report with JavaScript API.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/330206#M9780</link>
      <description>&lt;P&gt;Resurrecting this old post, but I hit this myself, and found a reasonable solution. The pageName setting does work, but the value required is not the "display name" you see in PowerBI, but actually an internal section ID. You can get this value by accessing the report in the web version of PowerBI and examining the URL.&amp;nbsp;&lt;BR /&gt;Ex, for my report below, my groupID is b5801...a4f, my reportID is 634f...054b, and my pageName is ReportSection50033...a22c&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://dave.powerbi.com/groups/b5801af2-7111-4b4a-b3c2-603b49af7a4f/reports/634f02e3-0f39-4fcb-8936-4a07039c054b/ReportSection50033d06d5078875a22c" target="_blank"&gt;https://dave.powerbi.com/groups/b5801af2-7111-4b4a-b3c2-603b49af7a4f/reports/634f02e3-0f39-4fcb-8936-4a07039c054b/ReportSection50033d06d5078875a22c&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While a little ugly, this lets you skip a double page load - I was having trouble with your solution above, as it's dependent on the timing of the report load. I achieved a workable solution by putting the page setter in a report loaded event, but I didn't like the user experience, as the default page (whatever I happened to edit last) would have to load before the desired page would load. Using the direct method with the internal ReportSection{ID} worked a lot cleaner.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2017 01:47:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/330206#M9780</guid>
      <dc:creator>daweins</dc:creator>
      <dc:date>2017-12-29T01:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: set active page in report with JavaScript API.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/351774#M10467</link>
      <description>&lt;P&gt;The simpliest solution is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    var report = powerbi.embed(reportContainer, config);

    report.on('loaded', function () {
        report.getPages().then(function (pages) {
            pages[1].setActive();
        });
    });

&lt;/PRE&gt;&lt;P&gt;or even simpler in ES6&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    const report = powerbi.embed(reportContainer, config);

    report.on('loaded', () =&amp;gt; {
        report.getPages().then(pages =&amp;gt; pages[1].setActive());
    });&lt;/PRE&gt;&lt;P&gt;report.getPages() at the beginning is not working because report itself is not fully loaded yet. Just for people who whant to set a page at the start.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2018 14:52:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/351774#M10467</guid>
      <dc:creator>slawek1151</dc:creator>
      <dc:date>2018-02-05T14:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: set active page in report with JavaScript API.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/495178#M15157</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello,&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm facing the same problem and this is not working for me.&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I get an error saying&amp;nbsp;"Property 'getPages' does not exist on type 'Embed'."&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you have any idea how to solve this?&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Cyrine.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Aug 2018 14:29:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/495178#M15157</guid>
      <dc:creator>bensalemc</dc:creator>
      <dc:date>2018-08-21T14:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: set active page in report with JavaScript API.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/557256#M17446</link>
      <description>&lt;P&gt;the problem is that this is not user friendly, the first page loads ... then gets changed to page x.&lt;/P&gt;&lt;P&gt;I don't understand why the documentation says something and when you can to implement it, it doesn't work.&lt;/P&gt;&lt;P&gt;updateSettings for locale doesn't work also ... &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Oct 2018 08:44:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/557256#M17446</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-31T08:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: set active page in report with JavaScript API.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/557633#M17477</link>
      <description>&lt;P&gt;You are calling&amp;nbsp;&lt;SPAN&gt;page.setActive() to early before the report has loaded. You must wait until the report loaded event has fired. Also, you should use phased loading so you can set the active page to page 2 before the report is first displayed to the user. Try something like this.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;// preload preload pbie scripts on this page
var preloadConfig = {
  type: 'report',
  baseUrl: 'https://embedded.powerbi.com/reportEmbed',
};

var preloadElement = powerbi.preload(preloadConfig);

preloadElement.onload(function () {
  console.log("pbie scripts now preloaded into this page");
});


// data required for embedding Power BI report
var embedReportId = "2cf7c5c5-4e1a-4df7-a2a6-21...";
var embedUrl = "https://app.powerbi.com/reportEmbed?reportId=2cf7c5c5-...";
var accessToken = "H4sIAAAAAAAEAB1WtQ7sCBL8l5fOSmZaaQMzMzszM49xdf9-o8076K...";

// Get models object to access enums for embed configuration
var models = window['powerbi-client'].models;

var config = {
  type: 'report',
  id: embedReportId,
  embedUrl: embedUrl,
  accessToken: accessToken,
  tokenType: models.TokenType.Embed,
};

// Get a reference to the embedded report HTML element
var reportContainer = document.getElementById('embedContainer');

// call load() instead of embed() to load the report while delaying the rendering process
var report = powerbi.load(embedContainer, config);

// when loaded event occurs, set current page then call render()
report.on("loaded", function () {
  console.log("loaded event executing");
  // call to get Pages collection
  report.getPages().then(
    function (pages) {
      // inspect pages in browser console
      console.log(pages);
      // display specific page in report
      var startPage = pages[1]; // this selects the second page
      config.pageName = startPage.name;
      // Call report.render() to display report
      report.render(config);
    });
});&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Oct 2018 13:44:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/557633#M17477</guid>
      <dc:creator>TedPattison</dc:creator>
      <dc:date>2018-10-31T13:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: set active page in report with JavaScript API.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/771431#M20465</link>
      <description>&lt;P&gt;Thanks for sharing. This works for me perfectly.&lt;/P&gt;&lt;P&gt;Also, for someone who has the same issue with bookmark, I'd like to add that the bookmark setting works the same way! Bookmark name setting just doesn't work when loading. I've been searching for the solutions. And it finally worked when I tried also with the GUID in the url, instead of the bookmark name. Like this&lt;/P&gt;&lt;P&gt;embedConfig={&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;'bookmark':{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"name":"Bookmarkfdc07f*******120"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;You can get the GUID in the url with your target bookmark on.&amp;nbsp;&lt;/P&gt;&lt;P&gt;app.powerbi.com/groups/.../ReportSectiond...?bookmarkGuid=&lt;FONT color="#3366FF"&gt;Bookmark6...1&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 03:29:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/771431#M20465</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-21T03:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: set active page in report with JavaScript API.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/3031854#M40808</link>
      <description>&lt;P&gt;Great response!&lt;BR /&gt;Setting the active page is required in order to use:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;EM&gt;&lt;STRONG&gt;await&amp;nbsp;visual.getSlicerState&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;() &lt;/STRONG&gt;&lt;/EM&gt;since this request only works with the active page.&lt;BR /&gt;Thank you.&amp;nbsp;&lt;BR /&gt;Vincent&lt;BR /&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 19 Jan 2023 15:56:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/3031854#M40808</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-19T15:56:11Z</dc:date>
    </item>
  </channel>
</rss>

