Skip to main content

system.kanoa.dashboard.addDashboardWidget

Description

Adds a widget to a dashboards breakpoint

Syntax

addDashboardWidget(widgetInfo, userId)

Parameters:
  • widgetInfo (dict)
  • userId (int): User ID

  • Returns:
  • dashboardWidgetId (int)
  • msg (strin): error message, None if successful
  • Dictionary

    ParameterTypeRequiredNotes
    dashboardIdint
    breakpointIdint
    widgetIdint
    rowStartintThe top row for this widget
    rowEndintThe bottom row for this widget
    columnStartintThe left most column for this widget
    columnEndintThe right most column for this widget
    enabledboolean

    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')