Interface: WidgetApi
WidgetApi.WidgetApi
Description
Contains APIs to allow registration for a widget type and creation/deletion of widgets on a dashboard
Properties
Properties
addOrUpdateWidget
• addOrUpdateWidget: (widgetType
: string
, state
: WidgetStateInfo
, id?
: string
, title?
: string
, isSingleton?
: boolean
) => void
Type declaration
▸ (widgetType
, state
, id?
, title?
, isSingleton?
): void
Description
Allows the developer to create or update an existing widget instance
Parameters
Name | Type | Description |
---|---|---|
widgetType
|
string
|
The name of the widget type that will be created or updated |
state
|
WidgetStateInfo
|
- |
id?
|
string
|
The id of the widget, only needed when updating a widget |
title?
|
string
|
The title of the widget |
isSingleton?
|
boolean
|
True if only one instance of a widget type can be present on the page |
Returns
void
deleteWidget
• deleteWidget: (widgetType
: string
, id?
: string
) => void
Type declaration
▸ (widgetType
, id?
): void
Description
Allows the developer to delete an existing widget instance
Parameters
Name | Type | Description |
---|---|---|
widgetType
|
string
|
The name of the widget type that will be deleted |
id?
|
string
|
The id of the widget |
Returns
void
onWidgetDelete
• onWidgetDelete: (widgetType
: string
, eventHandler
: WidgetDeleteEventHandler
) => void
Type declaration
▸ (widgetType
, eventHandler
): void
Description
Allows the developer to register a callback triggered when a widget is deleted
Parameters
Name | Type | Description |
---|---|---|
widgetType
|
string
|
The name of the widget type being deleted |
eventHandler
|
WidgetDeleteEventHandler
|
The callback function to be triggered |
Returns
void
onWidgetMenuCreate
• onWidgetMenuCreate: (eventHandlerName
: string
, eventHandler
: WidgetMenuEventHandler
) => void
Type declaration
▸ (eventHandlerName
, eventHandler
): void
Description
Allows the developer to register a callback triggered when the widget's menu is created
Parameters
Name | Type | Description |
---|---|---|
eventHandlerName
|
string
|
A unique name for the callback function |
eventHandler
|
WidgetMenuEventHandler
|
The callback function to be triggered |
Returns
void
registerWidgetType
• registerWidgetType: (widgetType
: string
, factoryFn
: WidgetFactory
, loadingElement?
: HTMLDivElement
, displayName?
: string
) => void
Type declaration
▸ (widgetType
, factoryFn
, loadingElement?
, displayName?
): void
Description
Allows the developer to register a widget type, where the factory function is called when a new instance of the widget is added to a dashboard
Parameters
Name | Type | Description |
---|---|---|
widgetType
|
string
|
The name of the widget that will show under the "Add Widget" menu button |
factoryFn
|
WidgetFactory
|
The factory function that will be called back to create the widget instance |
loadingElement?
|
HTMLDivElement
|
Optional div element to be shown when widget is in a loading state |
displayName?
|
string
|
Optional string to display in add widget dropdown menu. Uses the 'widgetType' value if not given. |
Returns
void