Articles in this section
Category / Section

Render the Dashboard After Publishing the newly created dashboard in JavaScript embedding

Published:

This article explains how to perform embedding to create a dashboard and subsequently render the dashboard in view mode once the newly created dashboard is published.

Steps to perform embedding to create dashboard and render in view mode:

  1. Download and run the sample applications for different platforms that help you render, edit, or create a new dashboard. Refer to the help documentation for instructions.

  2. Navigate to the BoldBI.create() method in the downloaded sample application and modify it to create a dashboard by referring to the help documentation.

function renderDashboard() {
    var dashboard = BoldBI.create({
        serverUrl: rootUrl + "/" + siteIdentifier,
        embedContainerId: "dashboard",
        embedType: BoldBI.EmbedType.Component,
        environment: environment == "enterprise" ? BoldBI.Environment.Enterprise : BoldBI.Environment.Cloud,
        width: "100%",
        height: "100%",
        mode: BoldBI.Mode.Design,
        expirationTime: 100000,
        authorizationServer: {
            url: authorizationServerUrl
        },
        actionComplete: "renderNewDashboard"

    });
    dashboard.loadDesigner();

};
  1. Trigger the actionComplete event with the method, here it is renderNewDashboard.
function renderNewDashboard(args) {
    if (args.eventType.toLowerCase() == "saveas") {
        var newDashboardId = args.data.dashboardId;
        var instance = BoldBI.getInstance("dashboard"); //container -> embed container id
        instance.destroy();
        var dashboard = BoldBI.create({
            serverUrl: rootUrl + "/" + siteIdentifier,
            dashboardId: newDashboardId,
            embedContainerId: "dashboard",
            embedType: BoldBI.EmbedType.Component,
            environment: environment == "enterprise"? BoldBI.Environment.Enterprise : BoldBI.Environment.Cloud,
            width: "100%",
            height: "100%",
            mode: BoldBI.Mode.View,
            expirationTime: 100000,
            authorizationServer: {
                url: authorizationServerUrl
            }

        });
        dashboard.loadDashboard();
    }
}
  1. Check the event type (“saveas”) to render the dashboard after publishing the newly created dashboard. Destroy the elements on the current page using the method destroy to render the new dashboard. To render it, use BoldBI.create() with the same container ID since the element inside it has been destroyed.

  2. Run the application to create the dashboard. Once you publish the dashboard, you will automatically be redirected to the dashboard view page of the newly created dashboard.

Additional References

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
SM
Written by Soundarya Mani Meharan
Updated:
Comments (0)
Please  to leave a comment
Access denied
Access denied