Can I generate several uiOutput-s from the same R Shiny module? -
here code in r shiny using modules.
i created module named mymodule , want generate 2 ui elements: selectinput , textinput. code example - in real application second element require result first element, want generate them separately.
i don't understand why second uioutput doesn't generate ui element indended to:
library(shiny) # define ui ui <- shinyui(fluidpage(mymoduleui("one"))) # define server logic server <- shinyserver(function(input, output, session) {callmodule(mymodule, 'one')}) #here ui module mymoduleui <- function(id) { ns <- ns(id) fluidrow( uioutput(ns('choosenumber')), uioutput(ns('entertext')) ) } #here server module mymodule <- function(input, output, session) { output$choosenumber <- renderui({ # in bigger program need ui generated database values, # thats why in server part of module ns <- session$ns selectinput(ns("thenumber"), label = 'select number', c(1,2,3)) }) # same here output$entertext <- renderui({ ns <- session$ns textinput(ns('thetext'),label = 'enter text:',value = 'abc') }) } # run application shinyapp(ui = ui, server = server)
thank you!
Comments
Post a Comment