# 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 |
# Constructor
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"));
# renderSimplyAsk L8.2.1 Beta
dash.renderSimplyAsk(container)
Renders the SimplyAsk NLQ UI into a container DOM element.
Limitations
- The
renderSimplyAsk
andpopSimplyAsk
methods cannot be used concurrently on the same page - When using this method, the SimplyAsk UI will not display the "Available Fields" button
Arguments
Name | Type | Required | Description |
---|---|---|---|
container | DOMElement | Yes | A DOM element to render into |
Returns
N/A
Example
Sisense.connect('http://10.50.60.206:30845/').then(function (app) {
app.dashboards.load('5e9edfedf52f45002d5a6844').then(function (dashboard) {
dashboard.renderSimplyAsk(document.getElementById("simplyAskContainer"));
});
});
# popSimplyAsk L8.2.1 Beta
dash.popSimplyAsk([options])
Opens the SimplyAsk NLQ popup as a modal dialog.
Limitations
- The
renderSimplyAsk
andpopSimplyAsk
methods cannot be used concurrently on the same page
Arguments
Name | Type | Required | Description |
---|---|---|---|
options | object | No | Configuration for the NLQ popup |
options.containerClass | string | No | A CSS class name that will be added to NLQ container |
Returns
N/A
Example
// With a container CSS class
Sisense.connect('http://10.50.60.206:30845/').then(function (app) {
app.dashboards.load('5e9edfedf52f45002d5a6844').then(function (dashboard) {
dashboard.popSimplyAsk({containerClass: 'custom-class-name'});
});
});
// Without any options
Sisense.connect('http://10.50.60.206:30845/').then(function (app) {
app.dashboards.load('5e9edfedf52f45002d5a6844').then(function (dashboard) {
dashboard.popSimplyAsk();
});
});
# 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
});