Reputation: 41
I am trying to render HTML
tags inside a reactable
in Shiny
. However the below example is not a shiny table. I have only kept the table in order to reduce the code.
I am not able to render the button here. It is showing as HTML
tags only. Is there a way to render the button?
library(reactable)
iris$new <- HTML('<html>
<body>
<button type="button" onclick="alert("Hello world!")">Click Me!</button>
</body>
</html>')
hidden_Columns = c('new', 'Species')
reactable(class = "rt", rownames = F, columns = c(list(
#ht = colDef(html = TRUE),
name = colDef(html = TRUE,width = 1000,
filterable = TRUE)),lapply(setNames(hidden_Columns, hidden_Columns), function(x){x = colDef(show =F)})),
defaultColDef = colDef(show = T), iris, details = function(index) {
htmltools::div(tags$style("table {
font-family: arial, sans-serif;
border-collapse: collapse;
margin: 40px;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 2px;
}
tr:nth-child(even) {
}"),tags$table(tags$tr(
tags$th('Species'),
tags$th('new')
)
,tags$tr(
tags$td(iris[index,][['Species']]),
tags$td(iris[index,][['new']])
)))
})
Upvotes: 2
Views: 138