Render HTML in Pivot Table
widget.on('ready', function(){
var tags = $('tbody span:contains("<")');
for(var i = 0; i<tags.length; i++){
$(tags[i]).replaceWith(String(tags[i].textContent))
}
});
Before
After
Challenge
Sisense Pivot Tables do not render HTML if it is coming in as a string from an elasticube or live data source.
Solution
Paste the script above into your Pivot Table's "Edit Script" environment.
-
Official comment
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 ConsultantComment actions -
Hi Shahar,
Are you using hte exact same code from this post?
If so, then my guess is that is related to the JQuery selector as it uses a generic one ( $('tbody span:contains("<")') ) so it will "catch" ANY span element that has a "<" char within a tbody element - the element that initiates the table.
Cheers,
Ravid
-
Hi Ahmed,
I always recommend having a separate table optimized for download.
You can make a duplicate of the table that has the hyperlink removed live in a jump to dashboard that is accessed through a text box for example.
A small text box above or below your pivot table can say go to printer friendly version and open the table with the raw data for export via Jump To Dashboard.
Hope this helps
Please sign in to leave a comment.
Comments
14 comments