From 1232f0381be50500aa8be74871c0d1106450d017 Mon Sep 17 00:00:00 2001 From: Eduardo Junior <edujrrib@gmail.com> Date: Sat, 27 Aug 2016 12:00:54 -0300 Subject: [PATCH] Corrige o restart das abas --- inst/ShinyApps/labestDataView/server.R | 40 +++++++++++++++++--------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/inst/ShinyApps/labestDataView/server.R b/inst/ShinyApps/labestDataView/server.R index 6ff0d52d..c98ec179 100644 --- a/inst/ShinyApps/labestDataView/server.R +++ b/inst/ShinyApps/labestDataView/server.R @@ -104,7 +104,7 @@ shinyServer( dig <- sapply(a, howmanydigits) print(xtable(a, digits = c(0, dig)), type = "html") } else { - cat("Selecione o conjunto de dados") + cat("Selecione o conjunto de dados.") } }) @@ -120,23 +120,35 @@ shinyServer( quote = FALSE) }) + ## Para fixar a aba selecionada + aba <- reactiveValues(x = "datasets") + observeEvent(input$TAB, { + aba$x <- input$TAB + }) + output$TABLE_DOC <- renderUI({ test <- input$DATASET == "" & is.null(input$OBRA) & is.null(input$KEYS) - if (test) { - tagList( - hr(), - includeMarkdown("ABOUT.md")## , - ## dataTableOutput("DATATABLE") - ) + if (length(test) == 0) { + includeMarkdown("ABOUT.md") } else { - tabsetPanel( - tabPanel("Lista de Datasets", - dataTableOutput("DATATABLE")), - tabPanel("Documentação", uiOutput("DOC")), - tabPanel("Tabela de dados", - tableOutput("TABLE")) - ) + if (test) { + return(includeMarkdown("ABOUT.md")) + } else { + tabsetPanel( + id = "TAB", + selected = aba$x, + tabPanel("Lista de Datasets", + dataTableOutput("DATATABLE"), + value = "datasets"), + tabPanel("Documentação", + uiOutput("DOC"), + value = "doc"), + tabPanel("Tabela de dados", + tableOutput("TABLE"), + value = "tabela") + ) + } } }) -- GitLab