Render HTML in Pivot Table

Comments

4 comments

  • Official comment
    Avatar
    Katie Garrison (Edited )

    Adding some steps to make a URL clickable within a pivot table:

    1. Create a custom column within the table with the URLs you would like to make clickable. In this example I called it HTMLURL

    Craft the HTML version of the link using <a href> tags. I used column "Link" as the URL and column "Name" as the display text

    '<a href="' + [Link] + '" target="_blank">' + [Name] + '</a>'

    This will create a column with the URL wrapped with HTML elements.

    3. Rebuild the cube to include the custom column

    4. Create a pivot table with the new column

    5. Edit the script of the widget, paste in the following script

    widget.on('ready', function(){
    var tags = $('tbody span:contains("<")');
    for(var i = 0; i<tags.length; i++){
    $(tags[i]).replaceWith(String(tags[i].textContent))
    }
    });

    6. Save the script and refresh the widget. The result should be a formatted link

    Hope that helps,
    Katie Garrison | Technical Solutions Consultant

  • Avatar
    Katie Garrison

    Awesome, thanks for sharing Artem!

  • Avatar
    Brian Wilson

    Hi Artem,

    Would this work in a basic table widget as well?

  • Avatar
    Artem Yevtushenko

    Hi Brian, the basic table widget should do this automatically!

    The pivot table widget encloses the cell text with span elements, so special characters for HTML are ignored. The basic table widget does not have these, so it will accept any text, including HTML.

Please sign in to leave a comment.