[英]too many scrollbars Shiny rhandsontable
I'm using rhandsontable with dqshiny to display a large table in an app.我正在使用 rhandsontable 和 dqshiny 在应用程序中显示一个大表。
I put some code below.我在下面放了一些代码。 In this code, there are maybe 4 scroll-bars.
在这段代码中,可能有 4 个滚动条。 2 in the table and 2 on the outer page.
表中 2 个,外页 2 个。
I only want 2 scroll-bars, can someone help?我只想要 2 个滚动条,有人可以帮忙吗? I have been messing with the CSS for hours to try and get the filters to show but also have scrollbars.
我一直在搞乱 CSS 几个小时,试图让过滤器显示,但也有滚动条。
library(shiny)
library(rhandsontable)
library(shinythemes)
library(shinyjs)
library(dqshiny)
df = data.frame(hello1 = seq(100), stringsAsFactors = FALSE)
df2 = df
for(i in 1:30){
df = cbind(df, df2)
}
names(df) = paste0(names(df), seq(20))
shinyApp(
ui = fluidPage(
theme = shinytheme("cerulean"),
navbarPage("sample Rhandsontable Page", selected = "tab01",
id = "navbar",
position = "fixed-top",
tags$style(type="text/css", "body {padding-top: 70px;}"),
tags$head(
tags$style(
#"body {overflow-y: scroll;}"
"body {overflow: visible;}"
)
),
tags$head(
tags$style(type = "text/css", ".container-fluid {padding-left:0px;
padding-right:0px; margin-right:0px; margin-left:0px;}")
),
useShinyjs(),
tabPanel("tab01",
tags$head(tags$style("#randomTable-filters {overflow:visible !important;}")),
tags$style('#randomTableTags * { white-space: nowrap}'),
tags$style('.shiny-html-output * {width = 100% }'),
div(id='randomTableTags', style="overflow: visible;",
dq_handsontable_output("randomTable")
)
)
)
),
server = function(input, output, session) {
dq_render_handsontable(
"randomTable",
df,
filters = "T",
page_size = c(500L, 1000L),
width_align = TRUE,
horizontal_scroll = FALSE,
table_param = list(highlightRow = TRUE, autoColumnSize = TRUE),
)
}
)
here is an image of the output:这是 output 的图像:
If you have trouble with dqshiny, you can run:如果您在使用 dqshiny 时遇到问题,可以运行:
library(devtools)
devtools::install_github('daqana/dqshiny', upgrade = 'always')
Solution 1: You can add this in your css file.解决方案 1:您可以将其添加到 ZC7A628CBA22E28EB17B5F5C6AE2A266AZ 文件中。 It should be applicable to all handsontable in your app.
它应该适用于您应用程序中的所有可动手操作。
.handsontable {
overflow: hidden;
}
Solution 2: You can use stretcH in your code to avoid extra scroll bars.解决方案 2:您可以在代码中使用 stretch 来避免额外的滚动条。
rhandsontable(data,stretchH = "all",stretchV = "all")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.