Category / Section
How to add a custom item to the widget header via embedding?
Published:
You can add custom item to the widget header and wire its functionality using the beforeIconRender and onIconClick events in embedding scenarios.
Follow these steps to add a custom item in widget header:
Now, you can see the custom item added in the widget header.
Custom item added to widget header
1. In JavaScript file, add the code snippet which helps to add icon and onclick action for the item.
function createNewWidgetIcon(args){
if(args.uniqueId == "9571f27a-c9d4-4b86-8a44-4e02ebfb1a18") //ID of the widget on which you wish to add a custom item. {
args.iconsinformation.push({
"class":"su su-manage-permission",
"tooltip":"Manage Permission",
"name":"Manage Permission"
});
}
}
function widgetIconClick(args){
// Write a code to perform a required operation when clicking this icon.
}
2. In BoldBI.create() method, add the API member widgetSettings and invoke the method for adding an icon in beforeIconRender and its onclick action in onIconClick.
var dashboard = BoldBI.create({
widgetSettings:{
beforeIconRender:"createNewWidgetIcon",
onIconClick:"widgetIconClick"
}
});
dashboard.loadDashboard();
Related links: