mardi 5 décembre 2017

Making columns to be dynamic by adding checkboxe in Shiny

I've been trying to add a row (basically a row of check boxes) on my data table, so that users will be able to decide which column they like to keep/delete. And here is what my Shiny App looks like so far. Anyone who knows any hints please help!

Any help would be appreciated!

ui <- dashboardPage(dashboardHeader(disable = T),
                dashboardSidebar(disable = T),
                dashboardBody(uiOutput("MainBody")))

server <- shinyServer(function(input, output){
  vals <- reactiveValues()
  vals$data <- data.table(vals$Data<-data.table(
           Brands=paste0("Brand",1:10),
           Forecasted_Growth=sample(1:20,10),
           Last_Year_Purchase=round(rnorm(10,1000,1000)^2),
           Contact=paste0("Brand",1:10,"@email.com")
 ))

      output$MainBody <- renderUI({
        fluidPage(
          box(width = 12,
          h3(strong("Template"), align = "center"),
          hr(),
          column(6, offset = 6, 
                 actionButton(inputId = "Del_Col", label = "Delete Select Column"))),
      column(12, dataTableOutput("MainTable")),
      tags$script()
    )
  })




Aucun commentaire:

Enregistrer un commentaire