In the shiny
app below I have a selectInput()
in which I want only the choices to be displayed but it will not be possible to select another one of the choices than the selected
one. In a few words I want it deactivated and only for display.
## app.R ##
library(shiny)
library(shinydashboard)
library(DT)
library(shinyjs)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
),
dashboardBody(
useShinyjs(),
uiOutput("sel")
)
)
server <- function(input, output,session) {
output$sel<-renderUI({
selectInput("ir","Select",choices = unique(iris$Species),selected=unique(iris$Species)[1],multiple = F)
})
observeEvent(input$ir, { updateSelectInput(session, "ir", selected=as.character("sel")[1]); })
}
shinyApp(ui, server)