闪亮的navbarPage与fluidRow结合

时间:2019-10-27 21:49:30

标签: r shiny fluid

在设置闪亮应用的布局时遇到了一些麻烦。在尝试了几种不同的选择之后,最适合我的一种是navbarPage。虽然,我设法解决了大多数问题(借助于stackoverflow),但我陷入了一个难题。 基本上,我的表有很多列,并且最终总是比包含该表的wellPanel大。

下面是一些说明问题的代码:

def add_node(self, node, object_dictionary=None, upload_eds=False):
        """Add a remote node to the network.
        :param node:
            Can be either an integer representing the node ID, a
            :class:`canopen.RemoteNode` or :class:`canopen.LocalNode` object.
        :param object_dictionary:
            Can be either a string for specifying the path to an
            Object Dictionary file or a
            :class:`canopen.ObjectDictionary` object.
        :param bool upload_eds:
            Set ``True`` if EDS file should be uploaded from 0x1021.
        :return:
            The Node object that was added.
        :rtype: canopen.RemoteNode
        """

运行代码时,您将看到当前布局。如果不是因为那张巨大的宽桌子3,那一半总是不在wellPanel中,那一切都会好起来的。

我的问题是是否可以将wellPanel扩展到左侧,使其占据布局的整个宽度?

任何指针都受到高度赞赏。 欢呼声

1 个答案:

答案 0 :(得分:1)

fluidRow和column函数在wellPanel / mainPanel内部内部不做任何事情-您希望将此特定的wellPanel作为其自己的fluidRow与边栏布局分开放置。

此外,如果表是在DT包中制成的,则可以将renderX = TRUE添加到渲染选项,以便在表太大而无法容纳时添加滚动条。

require(shiny)
require(shinythemes)

side_width <- 5

# user interface
ui <- navbarPage(
  "testing shiny",
  tabPanel("Tab1",
    sidebarLayout(position = "left",
      sidebarPanel(width = side_width,
        radioButtons("Radio1",
          label = h4("Radio label 1"),
          choices = list("Europe" = "EU",
                         "USA" = "US"),
          selected = "EU"),
        hr(),
        br(),
        radioButtons("Radio 2",
          label = h4("Radio label 2"),
          choices = list("Annual" = 1, "Monthly" = 12),
          selected = 1)),
      mainPanel(
        width = 12 - side_width,
        wellPanel(
          h5(helpText("Figure 1: ..."))
        ),        
        wellPanel(
          h5(helpText("Table 1: ..."))
        ),
        wellPanel(
          h5(helpText("Table 2: ..."))
        )
      )
    ),
    fluidRow(
        column(12,
            wellPanel(
               h5(helpText("Table 3: ..."))
            )
        )
    )
  ),

  tabPanel("Tab2",
           verbatimTextOutput("summary")),

  tags$style(type = "text/css", "body {padding-top: 70px;}"),
  theme = shinytheme("cosmo"),
  position = "fixed-top"

)
相关问题