Forum Discussion

cch1's avatar
cch1
Frequent Visitor
9 years ago
Solved

embed dashboard pageview.fitToWidth doesn't work

I receive the following error when we try to use the models.PageView.fitToWidth setting in an embedded dashboard's configuration details.  Is there a setting for dashboards?  I'm using v2.0.2 of the power bi api

 

Unable to get property 'fitToWidth' of undefined or null reference

 

var config = {
                type: 'dashboard',
                tokenType: models.TokenType.Embed,
                accessToken: accessToken,
                embedUrl: embedUrl,
                pageView: models.PageView.fitToWidth,
                id: embedDashboardId
            };

  • cch1 wrote:

    I receive the following error when we try to use the models.PageView.fitToWidth setting in an embedded dashboard's configuration details.  Is there a setting for dashboards?  I'm using v2.0.2 of the power bi api

     

    Unable to get property 'fitToWidth' of undefined or null reference

     

    var config = {
                    type: 'dashboard',
                    tokenType: models.TokenType.Embed,
                    accessToken: accessToken,
                    embedUrl: embedUrl,
                    pageView: models.PageView.fitToWidth,
                    id: embedDashboardId
                };

    cch1

    Thanks for reporting that. I can reproduce the same issue. I've found the reason is that the model doesn't contain such "PageView" attribute when trying to debug by "console.log(models);". As a workaround, use the constants "fitToWidth"/"oneColumn"/"actualSize" instead.

1 Reply

  • Eric_Zhang's avatar
    Eric_Zhang
    Microsoft Employee

    cch1 wrote:

    I receive the following error when we try to use the models.PageView.fitToWidth setting in an embedded dashboard's configuration details.  Is there a setting for dashboards?  I'm using v2.0.2 of the power bi api

     

    Unable to get property 'fitToWidth' of undefined or null reference

     

    var config = {
                    type: 'dashboard',
                    tokenType: models.TokenType.Embed,
                    accessToken: accessToken,
                    embedUrl: embedUrl,
                    pageView: models.PageView.fitToWidth,
                    id: embedDashboardId
                };

    cch1

    Thanks for reporting that. I can reproduce the same issue. I've found the reason is that the model doesn't contain such "PageView" attribute when trying to debug by "console.log(models);". As a workaround, use the constants "fitToWidth"/"oneColumn"/"actualSize" instead.