cancel
Showing results for 
Search instead for 
Did you mean: 

Add link to widget title

Lisha
8 - Cloud Apps
8 - Cloud Apps

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.

Lisha_0-1660808337061.png       

                Lisha_1-1660808458330.png

Also, is it possible to have a tooltip displayed on hovering over the widget / widget title.

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. 

1 ACCEPTED SOLUTION

harikm007
13 - Data Warehouse
13 - Data Warehouse

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

 

View solution in original post

4 REPLIES 4

harikm007
13 - Data Warehouse
13 - Data Warehouse

Hi @Lisha ,

Check if this dashboard script works for you:


dashboard.on('widgetbuildquery', function(se, ev){
	
	var widgetList = {
		'62d69b0258d2ad234e93e56d': '<a href="https://www.sisense.com/" target="_blank" title="My test tooltip 1">My Title 1</a>',
		'45dfa07e58t512002e94dt54': '<a href="https://www.w3schools.com" target="_blank" title="My test tooltip 2">My Title 2</a>'
	}
	if(widgetList[ev.widget.oid] != undefined)
	{
		$(`widget[widgetid="${ev.widget.oid}"] .transput-holder`).empty()
		$(`widget[widgetid="${ev.widget.oid}"] .transput-holder`).append(widgetList[ev.widget.oid])
		
		$(`widget[widgetid="${ev.widget.oid}"] widget-title`).empty()
		$(`widget[widgetid="${ev.widget.oid}"] widget-title`).append(widgetList[ev.widget.oid])
	}
	
})

harikm007_0-1660826092435.png

-Hari

 

Hi Hari,

I was looking for separate scripts - one where the widget title is a clickable link and another where a tooltip appears on hover. 
Also, is it possible to have widget level scripts and not dashboard level ?

Thanks for your help

 

harikm007
13 - Data Warehouse
13 - Data Warehouse

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

 

Thank you so much, Hari!