R/01.01_mod_select_department.R

# Module UI
  
#' @title   mod_select_department_ui and mod_select_department_server
#' @description  A shiny Module.
#'
#' @param id shiny id
#' @param input internal
#' @param output internal
#' @param session internal
#'
#' @rdname mod_select_department
#'
#' @keywords internal
#' @export 
#' @importFrom shiny NS tagList selectInput reactive
mod_select_department_ui <- function(id, liste){
  ns <- NS(id)
  tagList(
    
    selectInput(inputId = ns("departement"),
                label = "Département",
                choices = liste,
                selected = "FRANCE")
  )
}
    
# Module Server
    
#' @rdname mod_select_department
#' @export
#' @keywords internal
    
mod_select_department_server <- function(input, output, session){
  ns <- session$ns
  
  return(
    reactive({input$departement})
  )
  
}
    
## To be copied in the UI
# mod_select_department_ui("select_department_ui_1")
    
## To be copied in the server
# callModule(mod_select_department_server, "select_department_ui_1")
 
CedricMondy/bnvd documentation built on June 25, 2019, 5:57 p.m.