# SisenseWidget

An object representing a Sisense widget.

# Properties

Name Type Description
container DOMElement<DIV> The DIV element to be used as a container for the widget
metadata WidgetMetadata Contains an object representing the widget's metadata.
type string Contains the widget's primary type.
subtype string Contains the widget's sub-type.
affectDashboardFilters boolean Contains true if the widget is a selector (clicking it will create a filter), false otherwise.
refreshing boolean Contains true if widget is currently refreshing, false otherwise.
id string Contains the widget's ID.
queryResult object Contains the data returned for the widget's query from Sisense.
title string Contains the widget's title.
$$model Widget The internal widget instance - same as the widget object in a widget script

Note: the DIV element used for container must have an id as well as defined height and width dimensions for the widget to render correctly.

# Constructor

# Methods

# on

on(event, callback)

Registers any widget events. For more information, see the Widget API reference.

Arguments

Name Type Required Description Example
event string yes A string value of the event name. 'initialized'
callback function yes The callback function to execute when the event is triggered.

Returns

N/A

Example

widget.on('initialized', (ev, args) => {
    console.log('dashboard initialized');
});

# refresh

refresh()

Refreshes the widget.

Arguments

N/A

Returns

N/A

Example

widget.refresh();

# getDrillItems

getDrillItems() -> MetaDataItem[]

Returns an array of items available for drill down.

Arguments

N/A

Returns

An array of Metadata Items

Example

console.log(widget.getDrillItems().length);

# isDrillSupported

isDrillSupported() -> Object

Checks if the widget supports drill downs and returns an error if not.

Arguments

N/A

Returns

An object:

{
    supported: boolean
    error: 'string'
}

Example

console.log(widget.isDrillSupported().supported);

# loadDrillItems

loadDrillItems()

Loads items available for drill down. This method should be run for a widget once and before running any other methods related to drilldown.

Arguments

N/A

Returns

Promise resolving to an array of Metadata Items

Example

widget.loadDrillItems().then((items) => {
    console.log(items);
});

# loadDrillSuggestions

loadDrillSuggestions()

Loads suggested items for drill down.

Arguments

N/A

Returns

Promise resolving to an array of Metadata Items

Example

widget.loadDrillSuggestions().then((items) => {
    console.log(items);
});

# performDrill

performDrill()

Performs a drill down.

Arguments

N/A

Returns

N/A

Example

widget.performDrill();

# resetDrill

resetDrill()

Resets a drill down, reverting the widget back to its original state.

Arguments

N/A

Returns

N/A

Example

widget.resetDrill();