Lisha
08-18-2022Cloud Apps
Add link to widget title
Hello,
I have a requirement to add a URL to the widget title so the users will be redirected to a page that will give them more information about the widget data.
Can I achieve these 2 things for all widget types ?
NOTE :
I have already gone through below links and tried them. However, they are different from what I want to achieve.
https://community.sisense.com/t5/build-analytics/add-description-to-widget/td-p/3861
https://www.binextlevel.com/post/add-button-to-sisense-widget
FYI, some of my widgets are having JTDs. So on click of those widgets, I am redirected to another dashboard.
Here is the widget script
widget.on('buildquery', function(se, ev){ $(`widget[widgetid="${ev.widget.oid}"] .transput-holder`).empty() $(`widget[widgetid="${ev.widget.oid}"] .transput-holder`).append('<a href="https://www.sisense.com/" target="_blank" title="My test tooltip 1">My Title 1</a>') $(`widget[widgetid="${ev.widget.oid}"] widget-title`).empty() $(`widget[widgetid="${ev.widget.oid}"] widget-title`).append('<a href="https://www.sisense.com/" target="_blank" title="My test tooltip 1">My Title 1</a>') })
Remove 'title' attribute from above script, if you don't want tooltip on clickable title.
To add tooltip without clickable link:
widget.on('domready', function(se){ $(`widget[widgetid="${se.oid}"] .transput-holder .transput-caption`).attr('title', 'test tooltip') $(`widget[widgetid="${se.oid}"] widget-title`).attr('title', 'test tooltip') })
-Hari