簡體   English   中英

在 R shiny 中的 formattableOutput() 中設置寬度和高度

[英]Setting width and height in formattableOutput() in R shiny

嘗試通過水平和垂直方向滾動來修復 R shiny 中格式化表 output 的高度和重量。 然而,它在兩個方向上都溢出了。

將格式化表格包含在寬度為 4 的框中的任何方式。

library( shiny ) ; library( shinydashboard ) ; library( formattable )

runApp(shinyApp(
ui=(fluidPage(
titlePanel("data frame"),

mainPanel(
  fluidRow(
    
    box( title = 'Data 2', status = 'success', collapsible = T, width = 4, solidHeader = T,
         
         column( 12, formattableOutput( 'data_2_ouput' ) )
         
    )
    
  )
)
)),
server = (function(input, output) {

output$data_2_ouput = renderFormattable({
  
  formattable( mtcars,
               
               list(`Indicator Name` = formatter( 'span', style = ~style( color = 'grey', font.weight = 'bold' ) ),
                    
                    area() ~ color_tile( "#DeF7E9", "#71CA97" ) ) )
  
})

})))

我剛剛找到了解決方案。 添加此樣式選項即可完成工作。

column( 12, renderReactable( 'data_1_ouput' ), style = "height:500px; overflow-y: scroll;overflow-x: scroll;" )

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM