简体   繁体   中英

How to remove space between column layouts in tabItem for Shinydashboard

I am designing a shinydashboard where I want to split one of the pages for the tabs into two columns, the first with a width of 3, and the second with a width of 9. I am displaying an interface to download a csv file in the left column, and the resulting data frame in the left. But, there is a large space between the two (see image). I want to remove this space, or shrink it to a reasonable amount. 在此处输入图片说明

    ui <- dashboardPage(skin = 'green',
                        dashboardHeader(title = "SD Mesonet Data"),
                        dashboardSidebar(
                          sidebarMenu(
                            menuItem("Upload Data", tabName = "uploadData", icon = icon("folder")),
                            menuItem("Data Table", tabName = "dataTable", icon = icon("table")),
                            menuItem("Variable Statistics", tabName = "varStats", icon = icon("info-circle")),
                            menuItem("Inspect Data", tabName = "inspectData", icon = icon("chart-area"))
                          )
                        ),
                        dashboardBody(
                          tabItems(
                            # First tab content
                            tabItem(tabName = 'uploadData',
                                    fluidRow(
                                      column(width = 3, 
                                             box(fileInput("station_file", "Choose Station CSV File",
                                                           multiple = FALSE,
                                                           accept = ".csv"),
                                                 tags$hr(style="border-color: black;"),
                                                 checkboxInput("header", "Header", TRUE),
                                                 numericInput("skip", "# Rows to Skip", value = 1, min = 0, max = 100, step = 1),
                                                 textInput('nastrings','NA/NaN/Null Strings (separate w/commas)', 'NA,NaN,Null'),
                                                 background = "light-blue"
                                             )
                                      ),
                                      column(width = 9, 
                                             dataTableOutput("rawdata"))
                                    )
                            )
                            )
                          )
                        )
    
    server <- function(input, output){
    
      output$rawdata <- renderDataTable({
        req(input$station_file)
        rawdata <- read.csv(input$station_file$datapath,
                            header = input$header,
                            skip = input$skip,
                            na.strings = input$nastrings)
        rawdata
      })
    }
    
    shinyApp(ui, server)

Does anyone know how I would be able to remove that space? Thank you.

在 box() 内将宽度设置为 NULL,这将确保宽度由包含框的列设置(在您的情况下为 3)。

box(…, width=NULL)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM