0
入力用の送信ボタンと結果を隠す/表示するためのチェックボックスを含むShinyアプリを作成しようとしています。私の問題は、私が[Submit]ボタンをもう一度押していない限り、hide/showチェックボックスをチェックしたり、解除したりすることは効果がありません。Shiny with shinyjsの送信ボタンで結果を非表示/表示
ユーザーがチェックボックスをオンにして、送信ボタンに依存せずにチェックを外すとすぐに結果を表示するにはどうすればよいですか?それはthis質問に似ていますが、代わりにshinyjsパッケージを使用しています。
UI.R
ui <- shinyUI(fluidPage(
# Initiate shinyjs package
useShinyjs(),
# Select layout type
sidebarLayout(
# Sidebar content
sidebarPanel(
# Input phrase1
textInput("phrase1", "Enter a word or phrase here", "It’s not rocket"),
# Input phrase2
textInput("phrase2", "Enter a word or phrase here", "science"),
# Submit button
submitButton("Paste phrases")
),
# Main panel content
mainPanel(
# Checkbox to show/hide results
checkboxInput("checkbox", "Show results?", TRUE),
# Results
textOutput("full_phrase")
)
)
))
Server.R
server <- shinyServer(function(input, output) {
observe(toggle("full_phrase", condition=(input$checkbox==T)))
output$full_phrase <- renderText({paste(input$phrase1, input$phrase2)})
})
すべてのヘルプは大歓迎:
は、ここで問題を説明するためにいくつかのサンプルコードです!
ありがとうございました! – carozimm