inst/App_C/ui.R

library(shiny)
library(shinyjs)
library(DT)

ui <- fluidPage(titlePanel("App C"),
                useShinyjs(),
                sidebarLayout(
                  sidebarPanel(tabsetPanel(
                    id = "which",
                    tabPanel(
                      "Download",
                      selectizeInput(
                        "year",
                        "Choose year",
                        2011:2014,
                        multiple = TRUE,
                        options = list(
                          placeholder = "Choose year",
                          onInitialize = I('function() {this.setValue("")}')
                        )
                      ),
                      selectizeInput(
                        "age",
                        "Choose age group",
                        c("ADULT", "TEEN", "CHILD"),
                        multiple = TRUE,
                        options = list(
                          placeholder = "Choose year",
                          onInitialize = I('function() {this.setValue("")}')
                        )
                      ),
                      conditionalPanel(
                        condition = 'input.year != "" & input.year != null
                        & input.age != "" & input.age != null',
                        downloadButton("download", "Download Excel DB")
                      )
                    ),
                    tabPanel(
                      "Upload",
                      fileInput(
                        "uploader",
                        "Upload Excel file with changes",
                        accept = c(".xlsx", ".XLSX")
                      ),
                      actionButton("accept",
                                   "Accept Changes")
                    )
                    )),
                  mainPanel(
                    conditionalPanel(condition = "input.which=='Download'",
                                     DT::dataTableOutput("db")),
                    conditionalPanel(condition = "input.which=='Upload'",
                                     DT::dataTableOutput("changes"))
                  )
                  ))
carlganz/CSP2017 documentation built on May 13, 2019, 12:44 p.m.