小编Jel*_*ema的帖子

R shiny - DT :: renderDataTable列宽

我正在制作一个闪亮的应用程序,并遇到了一个小而刺激性的问题.我生产的部分输出是使用输出DT::renderDataTable.只有两列,第一列的宽度将取决于输入数据集,所以我不想绝对地将宽度固定为任何东西.我已经看过这个帖子,其中一个答案中的代码在某种程度上起作用.但是,如果我第二次按下actionButton,表会自行调整大小以填充输出窗口的整个宽度.

有没有办法防止表再次按下操作按钮后自行调整大小?我知道,只用renderTabletableOutput会解决这个问题,但我喜欢dataTableOutput,并希望使用该功能.

对于MWE:

library("shiny")
library("DT")

mwe_ui <- shinyUI(fluidPage(
    sidebarLayout(
    sidebarPanel(
      titlePanel("Example"),
      sliderInput(inputId = "df",
                  label = "Degrees of Freedom:",
                  min=1 , max=50 , value=1 , step=1
      ),
      actionButton(inputId = "compute1",
                   label = "Sample"
      )
    ),
    mainPanel(
      dataTableOutput( outputId = "summary" )
    )
  )))

mwe_server <- function(input, output) {

  temp01  <- reactive({
    compute1 <- input$compute1
    if( compute1 > 0 ){
      isolate({
        aa <- round( runif(6, 4,20 ) )
        bb <- character() …
Run Code Online (Sandbox Code Playgroud)

r shiny

5
推荐指数
1
解决办法
3044
查看次数

标签 统计

r ×1

shiny ×1