Skip to content

Instantly share code, notes, and snippets.

@tbadams45
Created August 4, 2016 21:14
Show Gist options
  • Save tbadams45/49c71a4314f6b4f299583f4ba96fee54 to your computer and use it in GitHub Desktop.
Save tbadams45/49c71a4314f6b4f299583f4ba96fee54 to your computer and use it in GitHub Desktop.
Using conditionalPanel inside of Shiny Modules
testUI <- function(id, label = "CSV file") {
# Create a namespace function using the provided id
ns <- NS(id)
tagList(
selectizeInput(
ns('mySelect'), 'Test Select', choices = state.name,
options = list(
placeholder = 'Please select an option below',
onInitialize = I('function() { this.setValue(""); }')
)
),
conditionalPanel(sprintf("input['%s'] != ''", ns("mySelect")), # works properly
actionButton("go1", "Go Button1")),
conditionalPanel(sprintf("input.%s != ''", ns("mySelect")), # will always show its content
actionButton("go2", "Go Button2"))
)
}
new_ui <- fluidPage(
testUI('myNamespace')
)
)
server <- shinyServer(function(input, output) {})
shinyApp(ui = new_ui, server = server)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment