system.kanoa.dashboard.addDashboardWidget
Description
Adds a widget to a dashboards breakpointSyntax
addDashboardWidget(widgetInfo, userId)- widgetInfo (dict)
- - dashboardId (int)
- - breakpointId (int)
- - widgetId (int)
- - rowStart (int): The top row for this widget
- - rowEnd (int): The bottom row for this widget
- - columnStart (int): The left most column for this widget
- - columnEnd (int): The right most column for this widget
- - enabled (boolean)
- int userId - User ID
- dashboardWidgetId (int)
- msg (strin): error message, None if successful
Code Examples
# Example usage
dashboardInfo = {
"dashboardId": 4,
"breakpointId": 1,
"widgetId": 7,
"enabled": True,
"rowStart": 8,
"rowEnd": 8,
"colStart": 2,
"colEnd": 20,
}
userId = 123
dashboardWidgetId, msg = system.kanoa.dashboard.addDashboardWidget(widgetInfo, userId)
if msg: system.perspective.sendMessage('showFailerToast', msg)
else: system.perspective.sendMessage('showSuccessfulToast', 'Dashboard widget has been saved')