繁体   English   中英

警告:dataTableOutput 中的错误:未使用的参数(高度 = “auto”)

[英]Warning: Error in dataTableOutput: unused argument (height = “auto”)

使用 dataTableOutput ( https://github.com/rstudio/DT ) 看到不一致的结果。 当我从 R 控制台启动 shiny 时,第一次运行应用程序时, dataTableOutput()中的高度参数会导致应用程序崩溃。 如果我然后 CTRL-C 停止 shiny,然后停止 shiny::runApp(),那么应用程序从此按预期工作。 不超过高度在当地是可以的。 该框被填充并自动调整其高度。 但是,当在 shinyapps.io 上加载应用程序时,该框始终为空且高度较小(例如 60 像素)。 无论我在 shinyapps.io 上做什么,如果高度是,例如height=300 ,那么应用程序总是会崩溃。 没有 CTRL-C 将适用于 shinyapps.io。 有时应用程序会在“height=300”存在时拒绝在本地启动,但如果我完全注释掉dataTableOutput ,重新运行 shiny::runApp(),然后在不重新启动 shiny 的情况下将 dataTableOutput 带回来,然后应用程序加载正常。

错误:

Warning: Error in dataTableOutput: unused argument (height = "200")
  100: h
   99: .handleSimpleError
   98: dots_list
   97: div
   96: dots_list
   95: div
   94: dots_list
   93: div
   92: box
   91: dots_list
   90: div
   89: fluidRow
   88: dots_list
   87: div
   86: column
   85: dots_list
   84: div
   83: fluidRow
   82: dots_list
   81: div
   80: tabItem
   79: lapply
   78: tabItems
   77: dots_list
   76: tags$section
   75: dots_list
   74: div
   73: dashboardBody
   72: tagAssert
   71: dashboardPage
   70: ..stacktraceon..
   69: eval
   68: eval
   67: sourceUTF8
   66: func
   65: uiHandlerSource
   64: handler
   63: handler
   62: handler
   61: handlers$invoke
   60: withCallingHandlers
   59: domain$wrapSync
   58: promises::with_promise_domain
   57: captureStackTraces
   56: withCallingHandlers
   55: withLogErrors
   54: withCallingHandlers
   53: force
   52: withVisible
   51: withCallingHandlers
   50: domain$wrapSync
   49: promises::with_promise_domain
   48: captureStackTraces
   47: doTryCatch
   46: tryCatchOne
   45: tryCatchList
   44: tryCatch
   43: do
   42: hybrid_chain
   41: force
   40: withVisible
   39: withCallingHandlers
   38: domain$wrapSync
   37: promises::with_promise_domain
   36: captureStackTraces
   35: doTryCatch
   34: tryCatchOne
   33: tryCatchList
   32: tryCatch
   31: do
   30: hybrid_chain
   29: handler
   28: func
   27: compute
   26: doTryCatch
   25: tryCatchOne
   24: tryCatchList
   23: tryCatch
   22: rookCall
   21: <Anonymous>
   20: evalq
   19: evalq
   18: doTryCatch
   17: tryCatchOne
   16: tryCatchList
   15: doTryCatch
   14: tryCatchOne
   13: tryCatchList
   12: tryCatch
   11: execCallbacks
   10: run_now
    9: service
    8: serviceApp
    7: ..stacktracefloor..
    6: withCallingHandlers
    5: domain$wrapSync
    4: promises::with_promise_domain
    3: captureStackTraces
    2: ..stacktraceoff..
    1: shiny::runApp

代码(两个示例框,尽管一个足以显示问题):

dashboardPage(
  dashboardHeader(title = 'Energy comparison'),
  dashboardSidebar(
    sidebarMenu(
      ...
      menuItem('Stacked', tabName = 'table', icon = NULL)
    )
  ),
  dashboardBody(
    tabItems(
      ...
      tabItem(
        tabName = 'table',
        fluidRow(
          column(6,
            fluidRow(
              box(title = 'Annual energy by source',
                solidHeader = TRUE, status = 'primary', width = 12,
                dataTableOutput('tab1') # Always works locally.
                                        # Doesn't crash shinyapps.io
                                        # but always show a tiny box
                                        # with no data.
              )
            )
          ),
          column(6,
            fluidRow(
              box(title = 'Annual energy by source %',
                solidHeader = TRUE, status = 'primary', width = 12,
                dataTableOutput('tab2', height="auto")
                  # height = "auto" or "300"
                  # Causes error sporadically locally.
                  # Can get it working locally by removing "height=..."
                  # then reloading the page while shiny is running.
                  # But this always crashes on shinyapps.io.
              )
            )
          )
        )
      )      
    )
  )
)

标签:数据表输出

dataTableOutput有两个函数,一个存在于shiny package 中,它没有height参数,另一个存在于DT package 中。 我不知道您是否正在加载DT package,但最好明确提及您要使用DT package 的dataTableOutput

DT::dataTableOutput('tab2', height="auto")

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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