# SisenseDash
An object representing a Sisense dashboard.
# Properties
Name | Type | Description |
---|---|---|
datasource | Datasource | Contains an object representing the dashboard's primary data source. |
id | string | Contains the full dashboard ID. |
refreshing | boolean | True when the dashboard is currently refreshing, or false when it is not. |
widgets | object | A collection of the widget objects currently loaded to memory for a the dashboard |
$$model | Dashboard | The internal dashboard instance - same as the dashboard object in a dash script |
# Constuctor
new Dashboard()
A blank dashboard object can be created and added to the application, into which various widgets may be loaded.
Doing this will not create an actual dashboard in Sisense - only a temporary object to host widgets on your application.
Example
// Create a blank dashboard object
var myEmptyDashboard = new Dashboard();
// Add dashboard to application
app.dashboards.add(myEmptyDashboard);
# Methods
# refresh
dash.refresh()
Refresh a dashboard to apply recent changes. Use this method to render the widgets in a dashboard once their containers are set.
Arguments
N/A
Returns
N/A
Example
dash.refresh();
# renderFilters
dash.renderFilters(container)
Renders the dashboard filters panel into a DIV container.
After you have loaded a dashboard, you can load its filters UI using this method.
Note: A dashboard object can only contain filters if it's datasource property is set. When loading existing dashboards, they are always loaded with a datasource. When creating a new object, you must set it yourself.
Arguments
Name | Type | Required | Description | Example |
---|---|---|---|---|
container | DOMElement<DIV> | Yes | A DIV element to render to | document.getElementById("filters") |
Returns
N/A
Example
dash.renderFilters(document.getElementById("filters"));
# on
on(event, callback)
Registers dashboard events. For more information, see the Dashboard 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
dash.on('initialized', () => {
console.log('dashboard initialized');
});
# widgets.get
dash.widgets.get(widgetId) →
SisenseWidget
Get a widget object from the dashboard by OID, when the widget is already loaded (such as widgets belonging to the dashboard or those loaded with the widgets.load
method)
Arguments
Name | Type | Required | Description | Example |
---|---|---|---|---|
widgetId | string | Yes | OID of the widget to get | '574603d5fc726c3430000037' |
Returns
A SisenseWidget
object.
Example
var myWidget = dash.widgets.get('5746043ffc726c3430000043');
# widgets.load
dash.widgets.load(widgetId) → Promise<
SisenseWidget
>
Load a widget by OID. Used to load widgets that aren't already in the dashboard object, such as when using a blank dashboard object.
Arguments
Name | Type | Required | Description | Example |
---|---|---|---|---|
widgetId | string | Yes | OID of the widget to load | '574603d5fc726c3430000037' |
Returns
A Promise
that resolves to a SisenseWidget
once the widget has been loaded.
Example
dash.widgets.load('574603d5fc726c3430000037').then(function(widget) {
// your code here
});