Created
August 4, 2016 21:14
-
-
Save tbadams45/49c71a4314f6b4f299583f4ba96fee54 to your computer and use it in GitHub Desktop.
Using conditionalPanel inside of Shiny Modules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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