Can anyone please tell me why the icons arent displaying in the rendered data table? All I can see is the code as opposed to one Trash Icon in the remove column for each of the rows in my table
It's worked fine for me on previous Shiny Apps - but when starting again for a new project I cant work out what's different.
Thanks!
library(dplyr)
library(data.table)
library(dplyr)
library(DT)
values <- data.table(a = c(1,2,3),b = c(4,5,6))
ui <- fluidPage(
DT::dataTableOutput('TabBU')
)
server <- function(input, output,session) {
shinyInput <- function(FUN, n, id, ses, ...) {
as.character(FUN(paste0(id, n), ...))
}
getRemoveButton <- function(n, idS = "", lab = "Pit") {
if (stringr::str_length(idS) > 0) idS <- paste0(idS, "-")
ret <- shinyInput(actionButton, n,
'button_', label = "Remove",icon = icon("trash-alt"),
onclick = sprintf('Shiny.onInputChange(\"%sremove_button_%s\", this.id)' ,idS, lab))
return (ret)
}
values = values %>%
mutate(id = 1:nrow(values))
values = values %>%
rowwise() %>%
mutate(Remove = getRemoveButton(id, idS = "", lab = "Tab1"))
output$TabBU <- renderDT(values)
}
shinyApp(ui, server)