Trying to fix the height and weight of a formattable output in R shiny with scrolling in horizontal and vertical directions. However it is overflowing in both directions.
Any way to contain the formatted table in a box of width 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;" )
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.