function renderDashboard() {
var boldbiEmbedInstance = BoldBI.create({
serverUrl: rootUrl + siteIdentifier,
dashboardId: dashboardId,
embedContainerId: "dashboard-container",// This should be the container id where you want to embed the dashboard
environment: BoldBI.Environment.Enterprise, // If Cloud, you should use BoldBI.Environment.Cloud,
mode: BoldBI.Mode.DataSource,
height: "800px",
width: "1200px",
authorizationServer: {
url: "http://localhost:8080/embeddetail/get"
},
dashboardSettings: {
beforeDesignerToolbarButtons: function(args){
args.toolbarButtons.push({
class: 'custom-button',
elementId: 'datasource_custom_button',
label: "Custom Button",
isActionBtn: true
});
},
beforeDesignerToolbarIconsRendered:function(args){
args.toolbarIcons.push({
class: "su su-nav-schedule",
elementId: "datasource_custom_icon",
enableSeperator: true,
iconType: "custom",
iconTooltip: "custom Icon",
label: "Custom Icon"
});
},
toolbarClick: function(args) {
if (args.target.target != undefined) {
var customObj = args.target.target.id.includes("button") ? "button" : "icon";//To check whether the clicked item is button or icon
var dialogHeader = customObj == "button" ? "You clicked button" : "You clicked icon";
var targetContainer = document.createElement("div");
targetContainer.id = "custom_dialog";
$('body').append(targetContainer);
var dialogDiv = document.createElement("div");
dialogDiv.id = "custom_toolbarClick_dialog";
targetContainer.append(dialogDiv);
var contentContainer = document.createElement("div");
contentContainer.id = "dialog-content";
var toolbarClickContent = createToolbarclickContent("div", { "class": "toolbar-click-content" }, customObj, args.click);
contentContainer.append(toolbarClickContent);
var dialog = new window.ejs.popups.Dialog({
header: dialogHeader,
width: window.innerWidth - 1420 + 'px',
isModal: true,
showCloseIcon: true,
target: document.getElementById('custom_dialog'),
content: contentContainer.outerHTML
});
dialog.appendTo('#custom_toolbarClick_dialog');
var dialogFooterDiv = createToolbarClickFooterDiv("div", { "id": "toolbar_click_footer","class":"dialog_footer" });
dialogDiv.append(dialogFooterDiv);
}
}
});
boldbiEmbedInstance.loadDatasource();
}