Clickable URL links in Pivot rows

Comments

33 comments

  • Official comment
    Avatar
    Zareen Durrani

    If there is only 1 row in the pivot table - the rendering causes the first row to show up as blank. 

    Additionally, if you do not want a widget script on your pivot table you can use the renderHTML plugin.

    To receive a copy please contact Sisense Support.

    Necessary actions:

    - unzip the contents of the renderHTML to your plugins folder
    - make sure the renderHTML plugin is enabled
    - completely remove or comment out the clickable links url script for each of the pivot widgets
    - refresh the dashboard

    Comment actions Permalink
  • Avatar
    Michael Becker

    Hi Lloyd,

    7.1.1 table has some changes and now links are not recognized properly. This script should allow to fix it. 

    widget.on('domready', function(scope, args) {
     var pivots = $('dashboard widget.columnar');
     for (k=0; k < pivots.length; k++) {
      if ($('dashboard widget.columnar')[k].attributes.widgetid.value === scope.oid) {
          var rows = $('TD');
          for (i=0; i<rows.length; i++) {
        var text = $($('TD', $('dashboard widget.columnar')[k])[i]).text();
        $($('TD', $('dashboard widget.columnar')[k])[i]).html(text)
          }
      }
     }
    })

    Put it into widget script. Please mind that this not support infinite scroll, so you will have to switch to paging if you use it.

    Regards,

    Michał

    2
    Comment actions Permalink
  • Avatar
    Shani Levin

    how can i use this in a table and not pivot?

    1
    Comment actions Permalink
  • Avatar
    Oxana Noa Umansky (Edited )

    Another way of accomplishing a clickable text field in your widget dashboard is by adding a custom field in your EC:

    *Prerequisites

    • Text field - This is the text you want to be clickable in your table ([title] in the code example below)
    • URL field - This is the url you want to attach to your Text field ([html_url] in the code example below)

    1) Add a custom field in the table you are working with and give it a name.

    2) Copy and paste the following expression in your custom field:

    '<a href="' + [html_url] + '" target="_blank">' + [title] + '</a>'

    * Make sure to use the Table widget.

    * In this example, we added  target="_blank" to ensure that each link will open in a new window. If you don't want this just remove it from the expression. 

    Big thanks to Ronen Avidor for this awesome tip! 

     

     

    1
    Comment actions Permalink
  • Avatar
    Ghada Turki (Edited )
    1
    Comment actions Permalink
  • Avatar
    Aware Manager

    Hi,

    What Micheal posted on May 24th works in displaying the link properly, however, as soon as you go to the next page, it reverts to text. Even when going back to the first page, unless you refresh. Is there an update to the script that could fix this?

     

    Thanks!

    1
    Comment actions Permalink
  • Avatar
    Tom Hirst

    There is a problem when going to the next page it reverts back to the text only without the HTML clickable link?

    Any ideas?

    1
    Comment actions Permalink
  • Avatar
    Tal

    This custom scripting responds poorly to drill down - or any change to number/order of columns, causes the desired column to stop being a link.

    Please advise how to work around this issue,

    Thanks 

    0
    Comment actions Permalink
  • Avatar
    Yael Turok

    Please note that you need to uncheck the "Widget Affects Dashboard filter" option in the widget settings for the link to work!

     

    0
    Comment actions Permalink
  • Avatar
    clickdashboard

    Please note that you need to define the column # that is holding the links under "var columnToMakeUrls = 2;" .If the count starts from 0 so you should  "var columnToMakeUrls = 0;".

    0
    Comment actions Permalink
  • Avatar
    Joseph Peters

    Is it possible to do this with a dashboard and apply current dashboard's filters and the selected field similar to:

    https://support.sisense.com/entries/57530174-Jump-to-sheet-with-applied-scope

    ?

    0
    Comment actions Permalink
  • Avatar
    Joseph Peters

    I'm seeing an issue where the link works fine in the widget editor view but doesn't work when looking at the dashboard as a whole.  The URL shows up with the correct formatting and the mouse turns into a hand icon but clicking doesn't do anything.

    0
    Comment actions Permalink
  • Avatar
    Joseph Peters

    Never mind, realized I had 'Widget affects dashboard filters' selected and that is why it wasn't working.

    0
    Comment actions Permalink
  • Avatar
    Michael Becker

    Hi Joseph,

    https://support.sisense.com/entries/62484610-Custom-Navigation-Homepage-with-applied-scope here you can see how to setup filters in the link. The only trouble I see is how to parse changed filter values to the link in Pivot

    0
    Comment actions Permalink
  • Avatar
    Quan

    Do we have any way to select multiple columns to make clickable links? Here, in var columnToMakeUrls = 2, we can just choose 1?

    0
    Comment actions Permalink
  • Avatar
    Joseph Peters

    @Quan, I believe you can just duplicate the code for the second column within the same widget function.  You may have to change the variables but I doubt it.

    0
    Comment actions Permalink
  • Avatar
    Gilad

    Hi, 

    I have just written a version for the regular table (not pivot).

    Also added an option to change the text for the whole column to something like my link.

    (If it will left blank, it will keep the original text).

    The code is in the attached file.

     




    Clickable URL links in a table column.js
    0
    Comment actions Permalink
  • Avatar
    Larry Craig

    To all the contributors to this script - thanks for your contribution.  Since I'm still learning JS, any hints on how to only enable the link for items in the column which either include a specific pattern ('http://') or exclude those with a specific pattern ('N/A') would be appreciated.

    0
    Comment actions Permalink
  • Avatar
    Yoni Lerner

    Hi Larry,

    In the script there's an if statement - if(cells.length > 0)

    This should eliminate the n/a values if it doesn't add a condition with OR for cells to be different from n/a  

    0
    Comment actions Permalink
  • Avatar
    David Wit

    Is there a way to modify the script to show a user friendly verbiage and hide the actual link?  

     

    0
    Comment actions Permalink
  • Avatar
    Larry Craig (Edited )

    David,

    From the code above, you should be able to create a 'friendly' version of the link.  This is similar to what Gilad has done with the 'Clickable URL links in a table column.js' script.  If the friendly link text is left as '', then the URL should be displayed instead.  The bold text below highlights my changes.

        // create html link tag according to the cell and tag
        function createLinkHTML(cell, tag){
            var linkElement = $(tag, cell);
    var link = linkElement.text();
            var friendlyLink = 'This is a link' || link;
            var htmlLink = '<a href="'+link+'" target="_blank">' + friendlyLink +'</a>'
            if(removeLinkDecoration){
                htmlLink = $(htmlLink).css('textDecoration','none').prop('outerHTML');
            }
            linkElement.html(htmlLink)        
        }
    0
    Comment actions Permalink
  • Avatar
    Oleg Fil (Edited )

    Hi,

    I've updated the script provided by Gilad.

    It contains fixes to keep URL formatting after table widget scrolling/paging

    Also I've changed the event name being listened to. It's now a "domready" event instead of "ready" which is fired when the widget DOM is rendered and ready for manipulations, thus eliminating the timeout in the code.

     

     

    Clickable URL links in a table column_updated.js

     

    0
    Comment actions Permalink
  • Avatar
    Harita Rani

    Hi,

     

    Can any one suggest, if the script is working when we enable widget affects dashboard filters?  I need Url's to be clickable when we enable widgets affects dashboard filters.

    Any help would be greatly appreciated.

     

    0
    Comment actions Permalink
  • Avatar
    Harita Rani

    Hi,

     

    Can any one suggest, if the script is working when we enable widget affects dashboard filters?  I need Url's to be clickable when we enable widgets affects dashboard filters.

    Any help would be greatly appreciated.

     

    0
    Comment actions Permalink
  • Avatar
    Lloyd Butler

    Hi Oxana,

    I have a Table widget that uses the method in your 5/10/2017 post. It worked great up through version 7.0.2.11001. However, when I upgraded to version 7.1.1.10089, it doesn't work anymore.

    In 7.1.1, the table's cell value just appears as regular text. The text starts with <a href.... For some reason, it's not been recognized as HTML code.

    In 7.0.2, that <a href... text was interrupted as actual HTML code and rendered as a link.

    Do you have any suggestions on how to update the code for 7.0.2+?

    Thank you.

    0
    Comment actions Permalink
  • Avatar
    Lloyd Butler

    Thank you Michael for the quick response. That worked great!

    0
    Comment actions Permalink
  • Avatar
    Stephanie Arredondo

    Hi All,

     

    I am using the script to link one of the columns to a external URL, but I want to use this link only when the value = 'No'.

     

    I tried to do it with the link variable but I think that doesn't work.

     

    Thanks!

    Stephanie.

     

     

    0
    Comment actions Permalink
  • Avatar
    Jessie Wang

    Hi Michael, does your script support a hyperlink to drill down?  thanks!

    0
    Comment actions Permalink
  • Avatar
    Simon Kim

    Is there way to use create a link url with 1st column's value (column = 0) but use the 2nd column as the friendly name (column = 1).

    Basically, I want the 

    var friendlyLink

    to be values from different column.

     

    Thanks in advance for any tips!

     

     

    0
    Comment actions Permalink
  • Avatar
    Eloy Meira

    Hi,

    It seems that if one encodes the link, the line linkElement.html wipes it out.

    like if you have spaces in the URL properly encoded with the value %20  then, the resulting URL is using a space so, obviously, the link will not work.

    Is there documentation how to do this? 

    Thanks.

    0
    Comment actions Permalink

Please sign in to leave a comment.