2017-10-23 4 views
0

の光沢のrenderUIを使用してこれは私の最初の質問は、stackoverflowです。私は光沢のあるモジュールやrenderUI(1.0.5)に問題があります。モジュール

私は印刷が発生しますので、その後、selectInputが入力$ S_A_Inputを変更する原因となります変更

#### Main Part 

ui <- bootstrapPage(
    uiOutput("DynamicContent") 
) 

server <- function(input, output,session) { 

    S_A <- selectInput("S_A_Input" ,"Change Me for print message",choices=1:3) 

    output$DynamicContent <- renderUI({ 
    tagList(S_A) 
    }) 

    observe({ 
    print(input$S_A_Input) 
    }) 

} 

shinyApp(ui = ui, server = server) 

でrenderUIを使用する場合。それはいいです。一方

私はモジュールで動作する場合、入力の$ S_A_Inputは、動作しないようです。その後、

### Module Part 

Module_YYY_Server <- function(input, output, session){ 

    S_A <- selectInput("S_A_Input" ,"Change Me for print message",choices=1:3) 

    output$DynamicContent <- renderUI({ 
    tagList(S_A) 
    }) 

    observe({ 
    print(input$S_A_Input) 
    }) 


} 


Module_YYY_Ui <- function(id){ 

    ns <- NS(id) # Creates Namespace 

    tagList(
    uiOutput("DynamicContent" %>% ns) 
) 

} 

とモジュールを呼び出します。

#### Main Part 

ui <- bootstrapPage(
    Module_YYY_Ui("YYY") 
) 

server <- function(input, output,session) { 
    callModule(Module_YYY_Server,"YYY") 
} 

shinyApp(ui = ui, server = server) 

この現象の解決策は見つかりませんでした。

答えて

1

あなたの例が簡素化されていると確信していますが、が現在行っていることに基づいて変更されていない場合は、renderUIを使用することはお勧めしません。それにかかわらず、あなたの入力が印刷されない理由は、それを出力として生成していないからです。

Module_YYY_Server <- function(input, output, session){ 

    output$DynamicContent <- renderUI({ 
    ns <- session$ns 
    tagList(
     selectInput("S_A_Input" %>% ns, "Change Me for print message",choices=1:3) 
    ) 
    }) 

    output$text <- renderText({input$S_A_Input}) 



} 


Module_YYY_Ui <- function(id){ 

    ns <- NS(id) # Creates Namespace 

    tagList(
    uiOutput("DynamicContent" %>% ns), 
    textOutput("text" %>% ns) 
) 

} 
+0

これは動作しません。:selectInputで何かを変更した場合、renderTextはありません。それは、光沢が反応$ S_A_Inputを入力として表示されないようです... – mathejoachim

+0

私の編集をチェックしてください。私は問題はそれが反応の外に定義されていると思う – tbradley

+0

まだ動作していないようです。 selectInputを変更するたびに、1から3までのように、出力に変更はありません。私が見るものは、selectInputが作成されますが、入力はありません$ S_A_input – mathejoachim

関連する問題