在闪亮的仪表板中隐藏元素(框/选项卡) [英] Hide an element (box/tabs) in shiny dashboard
本文介绍了在闪亮的仪表板中隐藏元素(框/选项卡)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个闪亮的仪表板,在登录页面上只有一个文本框。用户输入显示相关数据的电子邮件ID。这个很好用。然而,我需要一个框/选项卡面板,问候用户到达页面,当用户开始在文本输入中输入文本(电子邮件ID)时消失。这可能吗?
output$introbox=renderUI(box(h3("Welcome to the page. Please enter your email id to proceed")),
conditionalPanel(condition=input.emailid=="")
该框在登录页面时显示,但在输入文本时不会消失。
感谢您的帮助。谢谢
推荐答案
奥斯卡的答案是正确的。但它实际上并不使用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)
这篇关于在闪亮的仪表板中隐藏元素(框/选项卡)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文