cancel
Showing results for 
Search instead for 
Did you mean: 

Widget Events - Figure out the events taking place in your dashboard

Ophir_Buchman
Sisense Team Member
Sisense Team Member

While creating your scripts you might run into situations where you'd like to analyze what events take place and determine how to best implement your scripts. The following scripts will allow you to do so by dumping the information into your console window (Developer Tools):

Dumping the Dashboard's Events

Add the following code to your dashboard script:

dashboard.on('initialized', function(dashboard) {
console.log('Dashboard ' + dashboard.oid + ' - Event "initialized"')
Object.keys(dashboard.$$events).forEach(keyName => {
if (keyName.startsWith('widget'))
dashboard.on(keyName,function(dash,widget) {
console.log('Dashboard ' + dashboard.oid + ' - Event "' + keyName + '" for widget ' + widget.widget.oid)
})
else
dashboard.on(keyName,function() {
console.log('Dashboard ' + dashboard.oid + ' - Event "' + keyName + '"')
})
})
})

Example Output:

Ophir_Buchman_1-1649318307235.png

Dumping A Specific Widget's Events

Add the following code to your widget script:

widget.on('initialized', function(widget) {
console.log('Widget ' + widget.oid + ' - Event "initialized"')
Object.keys(widget.$$events).forEach(keyName => widget.on(keyName,function() {
console.log('Widget ' + widget.oid + ' - Event "' + keyName + '"')
}))
})

 Example Output:

Ophir_Buchman_0-1649316281676.png

Dumping both Dashboard and Widget Events

Add the following code to your dashboard script:

dashboard.on('initialized', function(dashboard) {
console.log('Dashboard ' + dashboard.oid + ' - Event "initialized"')
Object.keys(dashboard.$$events).forEach(keyName => {
if (keyName.startsWith('widget'))
{
dashboard.on(keyName,function(dash,widget) {
console.log('Dashboard ' + dashboard.oid + ' - Event "' + keyName + '" for widget ' + widget.widget.oid)
})
}
else
{
dashboard.on(keyName,function() {
console.log('Dashboard ' + dashboard.oid + ' - Event "' + keyName + '"')
})
}
})

dashboard.widgets.$$widgets.forEach(widget => {
Object.keys(widget.$$events).forEach(keyName => widget.on(keyName,function() {
console.log('Widget ' + widget.oid + ' - Event "' + keyName + '"')
}))
})
})

Example Output:

Ophir_Buchman_2-1649321821734.png

 

0 REPLIES 0
Voice of Customer
Impact Business Intelligence (BI) and Analytics Market Research

Click Here & Complete Dresner's Wisdom of Crowds® Market Study Survey Today!

Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Need additional support?:

Community Support Request

Don't miss out:

Earn a BETA Launch Challenge Badge!