mon*_*her 2 r shiny shinydashboard shinyjs
我有一个闪亮的仪表板,在登录页面上只有一个文本框.用户输入显示相关数据的emailid.这很好用.但是我需要一个盒子/选项卡面板,当用户开始在文本输入中输入文本(emailid)时,它会在到达页面时迎接用户并消失.这可能吗?
output$introbox=renderUI(box(h3("Welcome to the page. Please enter your email id to proceed")),
conditionalPanel(condition=input.emailid=="")
Run Code Online (Sandbox Code Playgroud)
该框显示在页面的着陆上,但在输入文本时不会消失.
感谢任何帮助.谢谢
Dea*_*ali 10
奥斯卡的回答是正确的.但它实际上并不使用shinyjs,而是手动包含所有JavaScript.你可以使用他的答案,但这里是使用shinyjs重写他的答案
library(shiny)
library(shinydashboard)
library(shinyjs)
ui <-dashboardPage(
dashboardHeader(),
dashboardSidebar(
),
dashboardBody(
useShinyjs(),
div(id = "greetbox-outer",
box( id ="greetbox",
width = 12,
height = "100%",
solidHeader = TRUE,
status = "info",
div(id="greeting", "Greeting here")
)
),
box( id ="box",
width = 12,
height = "100%",
solidHeader = TRUE,
status = "success",
textInput("txtbx","Enter text: ")
)
)
)
server <- shinyServer(function(input, output, session) {
observeEvent(input$txtbx,{
if (input$txtbx == "") return(NULL)
hide(id = "greetbox-outer", anim = TRUE)
print(input$txtbx)
})
})
shinyApp(ui = ui, server = server)
Run Code Online (Sandbox Code Playgroud)