Forum Discussion

arpost's avatar
arpost
Icon for Post Prodigy rankPost Prodigy
4 years ago

How can I show a mobile layout on the PBI Embedded Playground?

I'm wanting to explore mobile layout design in the PBI Embedded Playground (https://playground.powerbi.com/en-us/), but I keep getting an error when I try to change the sample report's settings to reflect the mobile layout.

 

First, I launch the sample report:

 

Then, I add the setting snippet for mobile layouts after confirming the sample report does have a mobile layout:

 

I'm adding the code as instructed here. This also happens with my own reports that have mobile layouts enabled.

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi arpost ,

    Please review the following threads, hope they can help you resolve the problem.

    Switch between mobile and desktop view in power bi embedded

    Instead of embedding two instances of a report you can do:

    1. Change the layout type by updating settings like here: change-layout-example. The downside of this approach is that your user's cross filters will not be saved when changing layout.

    2. Before changing the layout type, save a bookmark and then after changing the layout type apply the saved bookmark:

      function changeLayout(layoutType) {
          report.bookmarksManager.capture()
          .then(function (capturedBookmark) {
              var bookmarkState = capturedBookmark.state;
      
              var config = {
                  layoutType: layoutType
              };
              report.updateSettings(config).then(function () {
                  report.bookmarksManager.applyState(bookmarkState);
              })
          })
      }
      

      Please note that you will have to add error handling code to the sample above.

    3. Use Custom layout instead of mobile layout like here: Dynamic report layout. The downside of this approach is that you will have to write code that sets the layout dynamically.


    Mobile view is not being shown for embedded powerbi report

    Best Regards