培训
模块
在 Business Central 中使用 Power BI - Training
您是否希望了解如何在 Dynamics 365 Business Central 中使用 Microsoft Power BI? 如果是,本模块正适合您。 您将了解如何在 Power BI 中部署 Business Central 仪表板以及如何在 Business Central 中设置 Power BI。
powerbi.bootstrap
是客户端 SDK 版本 2.9.0 中引入的方法,可帮助开发人员更快地嵌入 Power BI 实体并提升性能。
使用 powerbi.embed
嵌入报表需要多个参数,例如 reportId
、embedURL
和 accessToken
。 这些参数并不总是立即可用。
powerbi.bootstrap
允许在提供所有必需参数之前开始嵌入。 启动 API 准备并初始化 iframe。
收到所需的参数后,应在同一 HTML 元素上调用 powerbi.embed(element, config)
。
powerbi.bootstrap(element, config)
方法接收元素和配置,与 powerbi.embed(...)
相同。
/**
* Given an HTML element and entityType, creates a new component instance, and bootstrap the iframe for embedding.
*
* @param {HTMLElement} an HTML Element where you need to embed. must be the same div element you will use in powerbi.embed.
* @param {IBootstrapEmbedConfiguration} config: a bootstrap config.
*/
bootstrap(element: HTMLElement, config: IBootstrapEmbedConfiguration): embed.Embed;
interface IBootstrapEmbedConfiguration {
type: string;
hostname?: string;
embedUrl?: string;
settings?: ISettings;
}
配置参数:
embedURL
,可以提供主机名。 主机名是嵌入 URL 的域名。 例如,如果嵌入 URL 为“https://app.powerbi.com/reportEmbed”,则主机名为“https://app.powerbi.com/”。 如果未提供主机名或 embedUrl,则使用默认主机名 https://app.powerbi.com/
。https://app.powerbi.com/
。以下示例在嵌入 Power BI 实体时提供引导方法的参考。
备注
请确保在收到嵌入参数后调用 powerbi.embed
。
若要启动用于嵌入报表,请执行以下操作:
powerbi.bootstrap(
reportContainerDivElement,
{
type: 'report',
}
);
若要启动嵌入仪表板,请执行以下操作:
powerbi.bootstrap(
reportContainerDivElement,
{
type: 'dashboard',
embedUrl: "https://app.powerbi.com/dashboardEmbed?dashboardId=06e3ba63-47ea-4579-b010-fdb5484b325a&config=eyJjbHVzdGVyVXJsIjoiaHR0cHM6mLndpbmRvd3MubmV0In0="
}
);
若要启动以仅主机名嵌入报表,请执行以下操作:
powerbi.bootstrap(
reportContainerDivElement,
{
type: 'report',
hostname: "https://app.powerbi.com"
}
);
若要启动以移动布局嵌入报表,请执行以下操作:
powerbi.bootstrap(
reportContainerDivElement,
{
type: 'report',
hostname: "https://app.powerbi.com",
settings: {
layoutType: models.LayoutType.MobilePortrait
}
}
);
如果不调用 powerbi.reset(element)
,则无法更改以下启动实体。
嵌入分页报表时不支持 powerbi.bootstrap
方法。
培训
模块
在 Business Central 中使用 Power BI - Training
您是否希望了解如何在 Dynamics 365 Business Central 中使用 Microsoft Power BI? 如果是,本模块正适合您。 您将了解如何在 Power BI 中部署 Business Central 仪表板以及如何在 Business Central 中设置 Power BI。