Hi,
I'm trying to render a table in a Shiny app using the htmlTable
function. I know renderhtmlTableWidget
and htmlTableWidgetOutput
exist, but they don't work for me. (Neither does datatable.) My data is a csv with contains a column of scripts like: <script type="text/javascript" src="https://forvo.com/_ext/ext-prons.js?id=55464"></script>
. The scripts render with htmlTable
outside of Shiny, but I can't even get the table to render with the Shiny runtime (I'm using Flexdashboard).
I just wanted to know if there's a way to get this to work. I've tried combinations of renderTable
, renderDataTable
etc. Here's a snippet of the code I have:
data <- reactive({
df %>%
filter(
Position == input$pos,
#Name == input$Name,
Country == input$country
)
})
output$tbl <- renderTable(
htmlTable(
data() %>% select(-Group, -Clr),
align='clc',
col.rgroup = data() %>% pull(Clr),
css.cell = "font-size: 12px",
css.table = "margin-top: .5em; margin-bottom: .5em; margin: auto; padding: 0px;
width: 80%"
)
)
tableOutput('tbl')
Which produces this:
`<table class='gmisc_table' style='border-collapse: collapse; margin-top: .5em; margin-bottom: .5em; margin: auto; padding: 0px; width: 80%' > <thead> <tr> <th style='border-bottom: 1px solid grey; border-top: 2px solid grey;'> </th> <th style='border-bottom: 1px solid grey; border-top: 2px solid grey; text-align: center;'>Position</th> <th style='border-bottom: 1px solid grey; border-top: 2px solid grey; text-align: center;'>Name</th> <th style='border-bottom: 1px solid grey; border-top: 2px solid grey; text-align: center;'>Country</th> </tr> </thead> <tbody> </tbody> </table>`