Guest User

Untitled

a guest
Oct 22nd, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. library(shiny)
  2. library(shinydashboard)
  3. library(shinyjs)
  4.  
  5. tabItem_welcome <-
  6. tabItem(tabName = "welcome",
  7. textInput("welcome_text", label=NULL, value = "")
  8. )
  9. tabItem_a <-
  10. tabItem(tabName = "a", id = "a",
  11. h2("A")
  12. )
  13.  
  14. dashboardPage(
  15. dashboardHeader(title = "test"),
  16. dashboardSidebar(
  17. sidebarMenu(id = "tab",
  18. menuItem("Welcome", tabName = "welcome"),
  19. menuItem("A", tabName = "a")
  20. )
  21. ),
  22. dashboardBody(
  23. useShinyjs(),
  24. tabItems(
  25. tabItem_welcome,
  26. tabItem_a
  27. )
  28. )
  29. )
  30.  
  31. shinyServer(function(input, output) {
  32.  
  33. hide(id = "a")
  34.  
  35. observe({
  36. welcome_text <- input$welcome_text
  37. if(welcome_text=="show a"){
  38. show(id = "a")
  39. }
  40. })
  41. })
Add Comment
Please, Sign In to add comment