2017-03-01 5 views
1

現在のドロップダウンメニューを表示するポップアップを作成したいとします。私のコードは最初のクリックではうまくいくようですが、もう一度クリックすると最初のモーダルが表示され、ポップアップを閉じることができません。例のコードは下に貼り付けられており、どんな提案も大変ありがとうございます。コードの簡素化RシャイニーBSModalポップアップで選択した入力を表示

library(shinyBS) 
shinyApp(

ui = basicPage(
actionButton("show", "Show modal dialog"), 
uiOutput("Box1"), 
uiOutput("modal") 
), 

server = function(session, input, output) { 

observeEvent(input$show,{ 
output$text <- renderText(input$select1) 
output$modal <- renderUI({ 
bsModal(paste("model", input$show, sep = ''), "Choice", "show", size =  "small", textOutput("text")) 
}) 
toggleModal(session,paste("model", input$show, sep = ''), "close") 
}) 

output$Box1 <- renderUI({ 
selectizeInput("select1","Select",c("A","B","C")) 
}) 

}) 

答えて

1

はそれを動作可能:

shinyApp(
    ui = basicPage(
    actionButton("show", "Show modal dialog"), 
    selectizeInput("select1","Select",c("A","B","C")), 
    bsModal("model", "Choice", "show", size ="small", textOutput("text")) 
), 

    server = function(session, input, output) { 
    output$text <- renderText(input$select1) 
    }) 
+0

完璧に動作することを!ご協力ありがとうございました – Jamie

関連する問題