RinteRface / shinydashboardPlus

extensions for shinydashboard
https://shinydashboardplus.rinterface.com
Other
454 stars 77 forks source link

dashboardFooter won't run when defined earlier (outside of ui) #128

Closed williamlai2 closed 3 years ago

williamlai2 commented 3 years ago

For example this code:

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)

header <-  dashboardHeader()
sidebar <-  dashboardSidebar()
body <- dashboardBody()
footer <- dashboardFooter(left = "Left content", right = "Right content")

shinyApp(
  ui = dashboardPage(
    header,
    sidebar,
    body,
    footer
  ),
  server = function(input, output) { }
)

Produces this error:

[1] "main-footer" Error in tagAssert(controlbar[[2]][[1]], type = "aside", class = "control-sidebar") : Expected an object with class 'shiny.tag'.

It is based on the code in the example here, but defined earlier (like you would when you have a lot in the app).

DivadNojnarg commented 3 years ago

This is coming from the dashboardPage parameters order:

dashboardPage(header, sidebar, body, controlbar = NULL, footer = NULL, ...)

The error would go away if you specify controlbar = NULL or NULL before putting the footer. Currently, footer is passed to the controlbar parameter causing the stop.

williamlai2 commented 3 years ago

Thanks. That fixed it.