Here's a test app that doesn't initially load the table with the following R version and packages.
library(shiny)
library(DT)
library(shinydashboard)
ui <- tagList(
tagList(
dashboardPage(
dashboardHeader(
disable=F,
title = "TEST", titleWidth = 180
),
dashboardSidebar(collapsed = F, width = 180,sidebarMenuOutput("sideBar_menu_UI")),
dashboardBody(
uiOutput("page"))
)
)
)
server <- function(input, output) {
output$sideBar_menu_UI <- renderMenu({
sidebarMenu(id="tabs"
,menuItem("Primary", tabName = "primary_tab", icon = icon(""),selected = T )
,menuItem("test1", tabName = "test1_tab", icon = icon(""))
)
})
output$test_dt <- DT::renderDataTable({
DT::datatable(data.frame("col_1"=seq(1:2),"col_2"=seq(1:2)),
rownames = FALSE,colnames=c("col1","col2" ),
selection = 'none', class = 'cell-border stripe',
options = list(ordering=F,
columnDefs = list(list(className = 'dt-center',targets=c(0,1))),
dom = 't'
)
) %>% formatStyle(0,target="row",lineHeight='12px')
},server=T)
output$page <- renderUI({
tabItems(
tabItem(tabName = "primary_tab", mainPanel(width = 12,
fluidRow(box(width=12,DT::dataTableOutput('test_dt'),solidHeader = TRUE))
)
),
tabItem(tabName = "test1_tab", mainPanel(width = 12,
HTML("<div style='height: 20px;'> </div>"),
fluidRow("in dev")
))
)
})
}
# Run the application
shinyApp(ui = ui, server = server)
Not working setup:
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.6 LTS
Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
[6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] shinydashboard_0.7.1 DT_0.9 shiny_1.4.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 digest_0.6.15 later_1.0.0 mime_0.5 R6_2.2.2 jsonlite_1.5 xtable_1.8-2
[8] magrittr_1.5 rlang_0.4.0 promises_1.1.0 tools_3.4.4 htmlwidgets_1.5.1 crosstalk_1.0.0 httpuv_1.5.2
[15] yaml_2.1.18 fastmap_1.0.1 compiler_3.4.4 htmltools_0.4.0
Older setup / packages with no issue:
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.6 LTS
Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
[6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] shinydashboard_0.7.1 DT_0.7 shiny_1.3.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.2 digest_0.6.22 later_1.0.0 mime_0.7 R6_2.4.0 xtable_1.8-4 jsonlite_1.6 magrittr_1.5 rlang_0.4.0
[10] promises_1.1.0 tools_3.4.4 htmlwidgets_1.3 crosstalk_1.0.0 httpuv_1.5.2 yaml_2.2.0 compiler_3.4.4 htmltools_0.3.6