【问题标题】:How to merge the Column names with the FluidRow in RShiny如何在 R Shiny 中将列名与 FluidRow 合并
【发布时间】:2018-10-22 15:19:58
【问题描述】:

我目前正在开发一个闪亮的应用程序。因为我没有得到预期的输出。预期的输出是

但我得到的输出是

这是使用的代码

ui.R

shinyUI(
  dashboardPage(
        dashboardSidebar(
      sidebarMenu(
        id = 'MENU', badgeColor = "aqua", 
        menuItem('VIEW', tabName = 'view'),
        menuItem('EDIT',tabName = 'edit')
      )
    ),
    dashboardBody(
      tabItems(tabItem(tabName = "edit",                      
      uiOutput("moreControls"))))

server.R

shinyServer(function(input, output, session) {
output$moreControls <- renderUI({
      wellPanel( 
        fluidRow(column(4,wellPanel(
          wellPanel("PEOPLE", style = "background-color:#0ec3c6;border-color:#0ec3c6;text-align:center;color: white;font-size: 24px;font-style: bold ;padding: 12px;"),
          style ="background-color:RGB(255,255,255); border-color:RGB(255,255,255);align:right;",
          textInput('email', 'Enter Email_Id'), 
          textInput('fn', ' Enter First Name')))))})
})

谁能帮我解决这个问题?提前谢谢..

【问题讨论】:

    标签: r shiny


    【解决方案1】:

    以下代码将为您提供所需的wellPanel 布局。 注意:我没有使用您的完整代码,只是尝试实现指定的布局。因此,如果它解决了您的问题,请替换代码块。

       library(shiny)
    ui <- fluidPage(
      wellPanel(
        fluidRow(column(4,
          fluidRow(wellPanel("PEOPLE", style = "background-color:#0ec3c6;border-color:#0ec3c6;text-align:center;color: white;font-size: 24px;font-style: bold ;padding: 12px;")),
          style = "background-color:RGB(255,255,255); border-color:RGB(255,255,255);align:right;",
          fluidRow(column(4,  "Enter Email-ID"), column(8, textInput(label = NULL, inputId = 'EmailID' ))),
          fluidRow(column(4, "Enter First Name"), column(8, textInput(label = NULL, inputId = 'FirstName')))))))
    
    server <- function(input, output, session) {
      onSessionEnded(stopApp)
    }
    shinyApp(ui, server)
    

    【讨论】:

    • 有什么办法可以去掉人物周围的空白?
    • 请说明您希望如何显示您的wellPanel。您提到的是哪些空白?
    • 在预期的输出中,项目(标题)周围没有空白。但在我的输出中,人物(标题)周围有一个空白区域。你能认出它吗?
    • 检查修改后的代码。将“人”wellPanel 放在fluidRow 中删除了空格。
    猜你喜欢
    • 2019-02-10
    • 2020-09-17
    • 2021-11-30
    • 1970-01-01
    • 2020-10-11
    • 1970-01-01
    • 2020-04-19
    • 2021-10-05
    • 1970-01-01
    相关资源
    最近更新 更多