Enabling Jump to Dashboard once a user drills down to a certain level
- 02-01-2024
Hi kingsofdeleon ,
You can use the following dashboard script to intercept the menu items as they're being generated.
let JTDEnabledDrillDim = '[DimCountries.Region]' let widgetOid = '65bacb7b874ecd0042b01e97' prism.on('beforemenu', (ev, args) => { let widget = args.settings.widget if (args.settings.widget.oid !== widgetOid) { return } if (args.settings.name !== 'datapoint') { return } if (widget.metadata.isDrilled() && widget.metadata.getDrilledItem().jaql.dim === JTDEnabledDrillDim) { return } Object.seal(args.settings.items) })
You'll need to specify the widgets oid and the drill dim that you'd like to enable the JTD from.
Unfortunately, as the JTD menu item is added to the items after the beforemenu event, the only way i've managed to solve this is by sealing the items object at this point. What we're doing is stopping the JTD service from adding the additional menu items, unless we're drilled into the desired dim. The side effect of this is that you'll get an error in the console stating that it was unable to add the JTD menu options. This shouldn't affect your user experience.
It's a bit backwards - my preference would be to remove the item afterwards, so I might raise with Sisense if the JTD service can run before we access through this event.
Let me know how you go?
Thanks,
Daniel
RAPID BI
RAPID BI - Sisense Professional Services | Implementations | Custom Add-ons