R/mod_server.R

Defines functions mod_server_server mod_server_ui

#' server UI Function
#'
#' @description A shiny Module.
#'
#' @param id,input,output,session Internal parameters for {shiny}.
#'
#' @noRd 
#'
#' @importFrom shiny NS tagList 
mod_server_ui <- function(id){
  ns <- NS(id)
  tagList(
  DT::dataTableOutput(ns("my_table"))
  )
}
    
#' server Server Functions
#'
#' @noRd 
mod_server_server <- function(id){
  moduleServer( id, function(input, output, session){
    ns <- session$ns
    
    output$my_table <- DT::renderDataTable( DT::datatable(data = mtcars, rownames = FALSE,
          options = list(dom = "tp"),
          caption = htmltools::tags$caption(style = 'caption-side: top; text-align: left;',
          "UI of server module. Note the server module is being called inside app_server.R as it contains
          server side processing.") ) )
    
  })
}
    
## To be copied in the UI
# mod_server_ui("server_ui_1")
    
## To be copied in the server
# mod_server_server("server_ui_1")
fizic37/skeleton_bs4_dash documentation built on Dec. 20, 2021, 8:42 a.m.