Last active
October 2, 2019 22:40
-
-
Save geebioso/9dce29fbd1ca06b33bc1e6b890d744ff to your computer and use it in GitHub Desktop.
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
library(shiny) | |
library(shinyjs) | |
mod1UI = function(id){ | |
ns = NS(id) | |
fluidRow( | |
shinyjs::useShinyjs(), | |
actionButton('show', 'Show'), | |
actionButton('hide', 'Hide'), | |
# shinyjs::hidden( | |
div(id = "div1", | |
h4("Div to Hide/show") | |
) | |
# ) | |
) | |
} | |
mod1 = function(input, output, session){ | |
ns = session$ns | |
observeEvent(input$show, { | |
shinyjs::show(ns('div1')) | |
}) | |
observeEvent(input$hide, { | |
shinyjs::hide(ns('div1')) | |
}) | |
} | |
ui <- fluidPage( | |
mod1UI('mod1') | |
) | |
server <- function(input, output, session){ | |
callModule(mod1, 'mod1') | |
} | |
# Run the application | |
shinyApp(ui = ui, server = server) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment