Forum Discussion

Lisha's avatar
Lisha
Cloud Apps
08-18-2022
Solved

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 fo...
  • harikm007's avatar
    harikm007
    08-18-2022

    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