Are embedded links in datatables broken in the new version?

313 views
Skip to first unread message

Clint Weathers

unread,
Feb 6, 2015, 3:51:15 PM2/6/15
to shiny-...@googlegroups.com
Did something change in the latest Shiny update to keep embedded links from rendering correctly?

When using a dataTableOutput, links I'd embed in datatable output worked just fine.  Now they don't. 

Here's what I have:

I have some data that I used a paste function to wrap into a URL like so:

<a href="http://pageyouwanttosee.com" target="_blank">Link</a>

This starts out as 
data$Link <- paste("http://pageyouneedtosee.com/", data$ordernumber, sep="")
then
data$Link
<- paste("<a href=\"", data$Link,"\"", "\ target=\"_blank", "\">", "Link", "</a>", sep="" )


so I end up with a data table of 

ordernumber  |  Link
____________________
1234               <a href="http://pageyouwanttosee.com/1234" target="_blank">Link</a>
2345               <a href="http://pageyouwanttosee.com/2345" target="_blank">Link</a>

When I drop this link into a blank HTML page and test it in a browser (FF, Chrome, IE8), it works just fine.

In Shiny, the data table now shows <a href="http://pageyouwanttosee.com/1234" target="_blank">Link</a> as plain, unlinked text. 
So near as I can tell, the link building isn't the problem -- it's how they're getting rendered in Shiny. 

I know Shiny went from bootstrap2 to bootstrap3, but I don't know enough about either to know what might have broken here.

Any ideas?  

Thanks



Joe Cheng

unread,
Feb 7, 2015, 4:15:26 AM2/7/15
to Clint Weathers, shiny-...@googlegroups.com
For security reasons, you now have to tell renderDataTable what fields are text and what fields are HTML. See the new "escape" parameter here:

In this case I think escape=-2 will work for you.

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/999ec44c-2b5c-4912-8781-275fa0d8e533%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages