Estou criando um Dashboard em Shiny
utilizando os módulos do Golem
.
Entretanto, as renderizações do servidor não estão aparecendo na UI. Tudo que eu adiciono na UI do módulo aparece no app, exceto os outputs que são renderizado no servidor.
Segue exemplo da renderização de uma datatable
.
O módulo:
#' @description A shiny Module.
#'
#' @param id,input,output,session Internal parameters for {shiny}.
#'
#' @noRd
#'
#' @importFrom shiny NS tagList
#' @import DT
mod_balanco_ui <- function(id){
ns <- NS(id)
mainPanel(
p('Esse texto aparece'),
DT::dataTableOutput(ns("tablecars"))
)
}
#' balanco Server Functions
#'
#' @noRd
mod_balanco_server <- function(id){
moduleServer( id, function(input, output, session){
ns <- session$ns
output$tablecars <- DT::renderDataTable({
DT::datatable(mtcars)
})
})
}
O app ui
#' @param request Internal parameter for `{shiny}`.
#' DO NOT REMOVE.
#' @import shiny
#' @import bs4Dash
#' @noRd
app_ui <- function(request) {
tagList(
# Leave this function for adding external resources
golem_add_external_resources(),
# Your application UI logic
bs4Dash::dashboardPage(
title = "dashboard",
dark = TRUE,
scrollToTop = TRUE,
bs4Dash::dashboardHeader(
bs4Dash::dashboardSidebar(
title = "Sidebar",
bs4Dash::sidebarMenu(
bs4Dash::menuItem(
"BC",
tabName = "bc",
icon = shiny::icon("angle-double-right"),
bs4Dash::menuSubItem(
"Balanço",
tabName = "balanco",
icon = shiny::icon("angle-double-right")
)
)
),
bs4Dash::bs4DashBody(
bs4Dash::tabItems(
bs4Dash::tabItem(tabName = "balanco",
mod_balanco_ui("balanco_ui_1")
)
)
)
)
)
)
}
Server ui
#' The application server-side
#'
#' @param input,output,session Internal parameters for {shiny}.
#' DO NOT REMOVE.
#' @import shiny
#' @noRd
app_server <- function(input, output, session) {
# Your application server logic
mod_balanco_server("balanco_ui_1")
}