[英]Setting width and height in formattableOutput() in R shiny
Trying to fix the height and weight of a formattable output in R shiny with scrolling in horizontal and vertical directions.尝试通过水平和垂直方向滚动来修复 R shiny 中格式化表 output 的高度和重量。 However it is overflowing in both directions.
然而,它在两个方向上都溢出了。
Any way to contain the formatted table in a box of width 4.将格式化表格包含在宽度为 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" ) ) )
})
})))
I just found the solution to this.我刚刚找到了解决方案。 Adding this style option does the job.
添加此样式选项即可完成工作。
column( 12, renderReactable( 'data_1_ouput' ), style = "height:500px; overflow-y: scroll;overflow-x: scroll;" )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.