Closed dysonsphere-startmail closed 2 years ago
this works for me
column_name=colDef(
cell=function(value, index) {
url <- sprintf(value)
htmltools::tags$a(href=url,
target="_blank",
as.character("link"))}
)
this works for me
column_name=colDef( cell=function(value, index) { url <- sprintf(value) htmltools::tags$a(href=url, target="_blank", as.character("link"))} )
Using this:
"Link" = colDef(colDef(
cell = function(value, index) {
url <- sprintf(value)
htmltools::tags$a(href=url,
target="_blank",
as.character("link"))})
)
I get the following error:
Error in colDef(colDef(cell = function(value, index) { :
`name` must be a character string
Checking my data frame, the "Link" column is character.
First - before posting issues on other persons projects:
The answer from @werkstattcodes is working just fine when I remove the nested colDef
from the last post:
library(shiny)
library(reactable)
ui <- fluidPage(
reactableOutput("table")
)
server <- function(input, output, session) {
output$table <- renderReactable(
reactable(
data = data.frame(Link = "Google"),
columns = list(
Link = colDef(
cell = function(value, index) {
url <- sprintf(value)
htmltools::tags$a(
href = url,
target="_blank",
as.character("link")
)
}
)
)
)
)
}
shinyApp(ui, server)
@dysonsphere If this solution is helpful to you please close the Issue :)
sorry about missing that obvious copy/paste error and not providing a working example. You suggestion worked. Thanks!
I have the following:
as part of a
columns = list
in a reactable.As is, it displays the "Full Text" and the link works to send the browser to the url address in the cell.
However, I am struggling with getting a the link to open in a new tab/window.
I have tried adding
target="_blank" rel="noopener noreferrer"
but I can't figure out how they fit in the JS.Can this be done?
Thanks