sisense.com

Widget Class

Defines widget behavior attributes.

Properties

NameTypeDescription
oidstringThe widget's unique ID
titlestringThe widget's title
TypestringThe widget's type
manifestWidgetManifestThe widget's manifest JSON
datasourceDatasourceThe widget's data source
metadataWidgetMetadataThe widget's meta-data object
optionsobjectThe widget's options object
styleobjectThe widget style object
initializedbooleanWhether the widget was initialized
refreshingbooleanWhether the widget is refreshing
queryResultqueryResultContains the last processed query result
rawQueryResultrawQueryResultContains the last raw query result
$dashboardDashboardA reference to the dashboard containing the widget
indicatorInstanceIndicatorInstanceOnly for indicator widgets
$$eventsEventsCollectionContains all available events for the dashboard and their handlers

Methods

refresh

refresh() → Promise

Refreshes the widget.

Arguments

N/A

Returns

A Promise that resolves when the widget has refreshed

Example

widget.refresh().then(function () {
    console.log('widget is refreshed');
});

redraw

redraw()

Requests a widget redraw.

Arguments

N/A

Returns

N/A

Example

widget.redraw();

destroy

destroy()

Releases the resources of the widget object .

Arguments

N/A

Returns

N/A

Example

widget.destroy();

on

on(eventName, eventHandler)

Subscribe to a widget event

Arguments

NameTypeDescriptionExample
eventNamestringEvent to register to'beforemenu'
eventHandlerfunctionEvent handler function

Returns

N/A

Example

widget.on('initialized', function () {
    console.log('widget initialized');
});

Events

initialized

Fired when the widget is initialized.

Arguments

NameTypeDescription
widgetWidgetWidget instance

domready

Fired when the widget is rendered and added to the DOM.

Arguments

NameTypeDescription
widgetWidgetWidget instance

refreshed

Fired when a widget is refreshed.

Arguments

NameTypeDescription
widgetWidgetWidget instance

buildquery

Fired when executing the widget's native build query and allows customization of the JAQL query object before execution.

Arguments

NameTypeDescription
widgetWidgetWidget instance
queryobjectJAQL query object

beforequery

Fired before the query is executed.

Arguments

NameTypeDescription
widgetWidgetWidget instance
queryobjectJAQL query object

querystart

Fired when the widget's query starts.

Arguments

NameTypeDescription
widgetWidgetWidget instance

queryend

Fired when the widget's query has ended.

Arguments

NameTypeDescription
widgetWidgetWidget instance
queryobjectJAQL query object
rawResultobjectJAQL query result
reasonstringQuery reason

processresult

Fired when executing the widget's native result processing, and allows customization of the query result before being rendered.

Arguments

NameTypeDescription
widgetWidgetWidget instance
queryobjectJAQL query object
resultobjectprocessed result
rawResultobjectJAQL query result
reasonstringQuery reason

render

Fired when the widget is rendered.

Arguments

NameTypeDescription
widgetWidgetWidget instance
reasonstringrendering reason
disableAnimationsbooleanIndicates whether animations should take place

ready

Fired when the widget's rendering is over and the widget is ready.

Arguments

NameTypeDescription
widgetWidgetWidget instance

readjust

Fired when a layout change is applied to the widget.

Arguments

NameTypeDescription
widgetWidgetWidget instance

beforewidgetindashboardmenu

Fired when clicking the widget's menu while viewing a dashboard.

Arguments

NameTypeDescription
widgetWidgetWidget instance.
itemsobject[]Array of items to be displayed.
elementDOMElementThe source element that triggers the event.
cancelbooleanDetermines whether the menu is displayed.

beforewidgetmenu

Fired when clicking the widget menu while in Edit Widget mode.

Arguments

NameTypeDescription
widgetWidgetWidget instance.
itemsobject[]Array of items to be displayed.
elementDOMElementThe source element that triggers the event.
cancelbooleanDetermines whether the menu is displayed.

beforeviewloaded

/chart - final Highcharts options /scattermap - Object that contains the map instance and the array of markers. Fired before the Highcharts object/map configuration is either updated or created. The event has two parameters, the first one is the widget model and the second is as described in the event arguments column.

Arguments

NameTypeDescription
widgetwidgetWidget instance.
elementdomobjectElement container
optionsobject

beforedatapointtooltip

Fired for all widgets that render a tooltip. Allows hooking to the tooltip initialization flow, disables the default application tooltip, and creates a new tooltip instead, or overrides the default tooltip template. The event has two parameters; the first one is the widget model, and the second is as described in the event arguments column. The widgets that support the event are: scatter map, area map and all the charts. In maps it is not possible to use the default tooltip and add some more html to it, it is possible only to change it completely.

For writing a property value from context, write in the template model.varPathFromContextExample: For context.pointScope.total, the template is: <div>model.pointScope.total</div>

Arguments

NameTypeDescription
widgetWidgetWidget instance
contextobjectDefault tooltip context. In charts there is context.pointScope for the point context
templatestringAngular template string of the default tooltip. Change it to replace the template
cancelbooleanDetermines whether the tooltip should be shown or not

destroyed

Fired when the widget is destroyed and it's resources are released.

Arguments

NameTypeDescription
widgetWidgetWidget instance

processcell

Fired when a cell is being processed and enables customization of the cell attributes (text, data, color, size).

Arguments

NameTypeDescription
widgetWidgetWidget instance
paneldatapanelData panel the cell is related to
itemitemThe item that the cell is related to
rowobjectThe entire result set that the row of the cell belongs to
cellobjectThe cell being processed
Last Updated: