How to add the widget to the existing pinboard using Javascript based embedding?
Add a Widget to the existing Pinboard using JavaScript Embedding
In the process of embedding a pinboard using JavaScript, you may find the need to add a widget to the existing pinboard. This article guides you through adding widgets to the existing pinboard using the method addWidgetToPinboard
.
Steps to Add a Widget
- First, get the instance of the BoldBI by using the
getInstance
method and passing the embed container id as a parameter.
var instance = BoldBI.getInstance("container"); //container -> embed container id
- Next, use the
addWidgetToPinboard
method to add the widget to the pinboard. This method requires three parameters:dashboardId
,widgetId
, andwidgetName
.
instance.addWidgetToPinboard(dashboardId, widgetId, widgetName);
Here, dashboardId
specifies the ID of the dashboard on which the widget to be added is presented. widgetId
and widgetName
are the id and name of the widget that is to be added, respectively.
Example
-
Open the embedding application project and navigate to BoldBI.create() method and include the respective code to render the pinboard.
Here, I have rendered the pinboard of the name “Pinboard” with two widgets in it, as shown below,
-
I have created a button and implemented the function
addWidget()
for the on-click functionality, where I have included theaddWidgetToPinboard
method to add the widget to the existing pinboard.
-
When you perform the click function, the respective widget will get added to the pinboard, like below.
Conclusion
By following these steps, you can easily add a widget to an existing pinboard using JavaScript embedding.