I am using shiny modules with some charts and everything works fine (amazing functionality!), ... but I can not make them work with valueBox (from shinydashboard). Nothing is rendered... Here is a minimal example:
library(shinydashboard)
# MODULE UI
bsc_tile_UI <- function(id) {
ns <- NS(id)
valueBoxOutput("tile1", width=12)
}
# MODULE Server
bsc_tile_OUT <- function(input, output, session, number, metric) {
output$tile1 <- renderValueBox({
valueBox(number, paste(metric), icon = icon("arrow-up"),color = "blue",
width=12)
})
}
ui<-dashboardPage(
dashboardHeader(title = "Dashboard"),
sidebar <- dashboardSidebar(disable = TRUE),
dashboardBody(
fluidPage(
bsc_tile_UI("tile_1"),
bsc_tile_UI("tile_2")
)
)
)
# App server
server <- function(input, output,session){
callModule(bsc_tile_OUT, "tile_1", '300', 'metric 1')
callModule(bsc_tile_OUT, "tile_2", '500', 'metric 2')
}
shinyApp(ui, server)
In the given example parameteres "number" and "metric" are explicitly provided, but my intention is they will be defined as variables of a dataframe.
Any help will be welcome!!! (sorry my english)