【问题标题】:To show fileinput and actionbutton inline内联显示文件输入和操作按钮
【发布时间】:2018-11-05 00:34:17
【问题描述】:

我正在尝试使用 R Shiny 构建一个应用程序,我在同一个框中使用文件输入和操作按钮。我面临显示以上两个内联的问题。请参考以下工作示例:

library(shiny)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(title = "Inline Widgets Issue"),
  dashboardSidebar(
  ),
  dashboardBody(  
    box(title = "Working Example",width=40 ,status = "warning", solidHeader = TRUE, collapsible = FALSE,
        fluidRow(column(width=8,fileInput('file1', 'Browse File',width="100%",
                                           accept=c('text/csv', 'text/comma-separated-values,text/plain', '.csv'))),
                        column(width=2,actionButton("save","Save!!")))
    ))
)

server <- function(input, output) {

}

shinyApp(ui, server)

目前是这样的情况: 我想要这样的东西:

【问题讨论】:

    标签: r shiny shinydashboard shinyjs


    【解决方案1】:

    您可以为您的操作按钮添加样式标签:

    library(shiny)
    library(shinydashboard)
    
    ui <- dashboardPage(
      dashboardHeader(title = "Inline Widgets Issue"),
      dashboardSidebar(
      ),
      dashboardBody(  
        box(title = "Working Example",width=40 ,status = "warning", solidHeader = TRUE, collapsible = FALSE,
            fluidRow(column(width=8,fileInput('file1', 'Browse File',width="100%",
                                              accept=c('text/csv', 'text/comma-separated-values,text/plain', '.csv'))),
                     column(width=2,actionButton("save","Save!!"))),
            tags$style(type='text/css', "#save { width:100%; margin-top: 25px;}")
        ))
    )
    
    server <- function(input, output) {
    
    }
    
    shinyApp(ui, server)
    

    您还可以使用 width 和 margin-top 来改变操作按钮的大小和位置。

    【讨论】:

      猜你喜欢
      • 2019-05-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-08
      • 2015-03-29
      • 2011-09-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多