how to use input function even out of it's scope

it is declared before ....I am talking about input$theme but declared afterwards

sidebar <- dashboardSidebar(uiOutput("sidebarpanel"),width = 260) 
body <- dashboardBody(shinyjs::useShinyjs(), uiOutput("body"))
ui<-dashboardPage(header, sidebar, body,shinyDashboardThemes(theme = input$theme))

it is declared after ,my code for entire dashboard is set up is like that,so i can not declare it vice versa, is there any way to access it. I might be wrong but about a year back ,i read somewhere that we might access it by << function but it did not work,does any one know i can access it even before declaring it ,I know it's kinda silly question to ask in the first place but I am in a position that I can not change the structure of my code.it would be great help if anyone guide me through,even a suggestion would be great.I know it would work if I reverse the order.

selectInput("theme","select Theme",choices =  c('blue_gradient', 'boe_website', 'grey_light','grey_dark',
                                  'onenote', 'poor_mans_flatly', 'purple_gradient'))

okay, I got it worked out somehow. it's not ideal way but to work around

ui<-dashboardPage(header, sidebar, body,shinyDashboardThemes(theme = "blue_gradient"))

selectInput("theme","select Theme",choices =  c('blue_gradient', 'boe_website', 'grey_light','grey_dark',
                                  'onenote', 'poor_mans_flatly', 'purple_gradient')),
        ),
  tabItem("forecast",
          fluidPage(withLoader(dygraphOutput("dy"),type = "html",loader = "loader2"))
          ),
   uiOutput("myTheme")
       )

output$myTheme <- renderUI(shinyDashboardThemes(theme = input$theme))

Hello,

I must say I don't understand what you are asking here and the code snippets you provide are not helping :slight_smile: In future, try and create a reprex and be a bit clearer in your request and we might be able to help.

If you indeed have solved your issue yourself, please mark your post as the solution.

Kind regards,
PJ

1 Like

Thanks for your guidence and I will take care next time and create the reprex in the future.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.