what have you tried?
I'd be more inclined to even look at this if you had a reprex (reproducible example) of a simple shiny app that had the table , and was just missing the drop down element... also you should write what you would want the drop downs to be populated with. as its not clear.
1 Like
Hi,
I am fairly new to rshiny, however I did the code below and I have updated how the table should look like. Thank you for the earlier response also.
observe({
output$futureData <- renderTable(
{
X <- data.frame(Field= c("DDD","EEE","WWW","RRR","RRR"), a = c("Yes","No","Yes","Yes","Yes"),
b = c("No","No","Yes","No","No"), c = c("Yes","Yes","Yes","No","No"),
d = c("Yes","Yes","Yes","Yes","Yes"))
return(X)
}
)
})
library(shiny)
library(DT)
ui <- fluidPage(
shiny::verbatimTextOutput(outputId = "rad_buts"),
DT::dataTableOutput("futureData")
)
server <- function(input, output, session) {
output$futureData <- DT::renderDataTable({
x <- data.frame(
Field = c("DDD", "EEE", "WWW", "RRR"),
a = c("Yes", "No", "Yes", "Yes"),b = c("No", "No", "Yes", "No"), c = c("Yes", "Yes", "Yes", "No"),
d = c("Yes", "Yes", "Yes", "Yes")
,
e = c(
as.character(radioButtons("radioDDD",
label = h6("radioDDD"),
choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3),
selected = 1
)),
as.character(radioButtons("radioEEE",
label =h6("radioEEE"),
choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3),
selected = 1
)),
as.character(radioButtons("radioWWW",
label = h6("radioWWW"),
choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3),
selected = 1
)),
as.character(radioButtons("radioRRR",
label = h6("radioRRR"),
choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3),
selected = 1
))
)
)
DT::datatable(data=x,
options = list(
drawCallback= JS(
'function(settings) {
Shiny.bindAll(this.api().table().node());}')
),selection='none',escape=F) %>% formatStyle(names(x), `font-size` = '8px')
})
output$rad_buts <- renderPrint({
paste0(input$radioDDD,
input$radioEEE,
input$radioWWW,
input$radioRRR,
collapse = "\n")
})
}
shinyApp(ui, server)
Thank you very much sir! This will really be of great help.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.