9

I have renderTable with url links:

output$url_list <- renderTable({
   url_list<-as.data.frame(urls_from_plg_table())
}, sanitize.text.function = function(x) x, target="_blank",
   options = list(aLengthMenu = c(5, 30, 50), iDisplayLength = 5))

I want to open the URLs from this table in a new tab from my shiny app.

I try add: target="_blank", but it doesn't work in this way. How can I go about it?

Thank you!

1
  • Can you share what output you do get? Or how we'd recreate urls_from_plg_table()? What kind of data does that store? Commented Feb 20, 2014 at 16:35

1 Answer 1

11

Use a string with the HTML tag in your data.frame. (And don't forget sanitize.text.function = function(x) x to evaluate your HTML tags as is).

For example :

shiny::runApp(list( 
  ui = bootstrapPage(

    tableOutput("table")

    ),

  server = function(input, output) {

    output$table <- renderTable({

      urls <- c("http://www.google.fr", "http://www.google.fr")
      refs <- paste0("<a href='",  urls, "' target='_blank'>GOOGLE</a>")

      data.frame(refs)

    }, sanitize.text.function = function(x) x)

  }
))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.