sisense.com

Dashboard Class

Defines the dashboard's attributes, including layout, contained widgets, and filters.

Properties

NameTypeReadonlyDescription
oidstringYesDashboard ID
titlestringNoTitle
descstringNoDescription
ownerstringYesOwner OID
userIdstringYesInstance User OID
instanceTypestringYesWhether the instance is the origin (owner) or a viewer's copy
createdDateYesDate created
lastUpdatedDateYesDate last updated
lastUsedDateYesDate last used
lastOpenedDateYesDate last opened
instanceidstringYesUnique ID of the dashboard instance
datasourceDatasourceNoPrimary Datamodel used by the Dashboard
filtersDashboardFiltersNoAn array of Dashboard Filters
widgetsDashboardWidgetsNoAn array of Widgets in the Dashboard
layoutDashboardLayoutNoAn Object describing the Dashboard's grid-like layout
initializedbooleanYesIndicates if the dashboard has been initialized
refreshingbooleanYesIndicates if the dashboard is currently refreshing
editingbooleanYesIndicates if the dashboard is currently in edit state
autoUpdateOnFiltersChangebooleanYesIndicates if the dashboard is in auto-refresh mode
$$eventsEventsCollectionYesContains all available events for the dashboard and their handlers

Methods

refresh

refresh() → Promise

Refreshes the dashboard.

Arguments

N/A

Returns

A Promise that resolves when the dashboard has refreshed

Example

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

addWidget

addWidget(widget[, layout])

Adds the given widget to the dashboard.
If layout is not provided, the widget is placed at the bottom of the first column in the dashboard.

Arguments

NameTypeRequiredDescription
widgetWidgetYesWidget model to be added.
layoutWidgetLayoutNoLayout object that defines the widget's placement.

Returns

N/A

Example

dashboard.addWidget(
    {
        // Widget model
    },
    {
        // Layout model
    }
);

datasources

datasources() → Array<Datasource>

Returns an array of datasource objects used by the various widgets in the dashboard.

Arguments

N/A

Returns

An array of Datasource objects

Example

console.log(dashboard.datasources().length);

isEmpty

isEmpty() → boolean

Returns a response stating whether the dashboard includes widgets, or is empty.

Arguments

N/A

Returns

A boolean indicating whether the dashboard is empty (has no widgets).

Example

console.log(dashboard.isEmpty());

destroy

destroy()

Releases the resources of the dashboard object and contained widgets.

Arguments

N/A

Returns

N/A

Example

dashboard.destroy();

on

on(eventName, eventHandler)

Subscribe to a dashboard event

Arguments

NameTypeDescriptionExample
eventNamestringEvent to register to'beforemenu'
eventHandlerfunctionEvent handler function

Returns

N/A

Example

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

Events

initialized

Fired after the dashboard is initialized.

Arguments

NameTypeDescription
dashboardDashboardDashboard instance.

refreshstart

Fired after one or more widgets have started the refresh process.

Arguments

NameTypeDescription
dashboardDashboardDashboard instance.
totalQueriesnumberNumber of queries in the current run.

refreshend

Fired when a refresh process ends for one or more widgets.

Arguments

NameTypeDescription
dashboardDashboardDashboard instance.
completedQueriesnumberof completed queries.

widgetrefreshed

Fired when a widget refresh has ended.

Arguments

NameTypeDescription
dashboardDashboardDashboard instance.
widgetWidgetRefreshed widget.
totalQueriesnumberNumber of queries in the current run.
completedQueriesnumberNumber of completed queries.

widgetadded

Fired when a widget was added to the dashboard.

Arguments

NameTypeDescription
dashboardDashboardDashboard instance.
widgetWidgetAdded widget.
layoutwidgetLayoutLayout options object.

stylechanged

Fired when the dashboard style is changed.

Arguments

NameTypeDescription
dashboardDashboardDashboard instance.

destroyed

Fired when the dashboard is destroyed.

Arguments

NameTypeDescription
dashboardDashboardDashboard instance.

editstart

Fired when entering edit mode.

Arguments

NameTypeDescription
dashboardDashboardDashboard instance.

editend

Fired when leaving edit mode.

Arguments

NameTypeDescription
dashboardDashboardDashboard instance.

filterschanged

Fired when the dashboard filter changes.

Arguments

NameTypeDescription
dashboardDashboardDashboard instance.
typestringChange type. Available values: add/update and remove.
itemsMetadataItem[]Affected filter items

widgetinitialized

Fired when the widget is initialized.

Arguments

NameTypeDescription
widgetWidgetWidget instance.

widgetbuildquery

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.

widgetbeforequery

Fired before the query is executed.

Arguments

NameTypeDescription
widgetWidgetWidget instance.
queryobjectJAQL query object.

widgetprocessresult

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

Arguments

NameTypeDescription
widgetWidgetWidget instance.
queryobjectJAQL query object.
resultqueryResultProcessed result.
rawResultrawQueryResultJAQL query result.
reasonstringQuery reason.

widgetrender

Fired when the widget is rendered.

Arguments

NameTypeDescription
widgetWidgetWidget instance.
reasonstringRendering reason.
disableAnimationsbooleanIndicates whether animations are enabled.

widgetready

Fired when the widget’s rendering is complete and the widget is ready.

Arguments

NameTypeDescription
widgetWidgetWidget instance.

beforewidgetmenu

Fired before a widget shown in a dashboard shows it’s context menu.

Arguments

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

widgetdestroyed

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

Arguments

NameTypeDescription
widgetWidgetWidget instance.

Types

widgetLayout

Groups a set of widget layout related attributes in a single object, used to define where within a dashboard's layout a new widget should be positioned.

Properties

PropertyTypeDescription
colDashboardLayoutColumnAncestor column object.
colidxintegerColumn index.
cellDashboardLayoutCellAncestor cell object.
cellidxintegerCell index in its parent column cells collection.
subcellDashboardLayoutSubcellAncestor sub-cell object.
subcellidxintegerSub-cell index in its parent cell sub-cells collection.
elementDashboardLayoutElementParent element object.
elementidxintegerElement index in its parent sub-cell elements collection.

EventsCollection

The property $$events of the Dashboard and Widget objects contains this key-value pair of all available events for the object and all event handlers registered to them.

The basic structure of the object is:

{
    eventName: {
        name: 'eventName',
        handlers: []
    }
}

Each event name key contains an object with the following properties:

PropertyTypeDescription
namestringString representation of the event name
handlersfunction[]An array of registered handlers for the event
Last Updated: