r语言 - 串扰使滚动条在与可重定向结合使用时在弹性仪表板中不可见



我使用excelentcrosstalk r package为我的可反应的htmlwidget制作过滤器。我在flexdashboard中显示可反应性.当使用reactablegroupBy功能时,我注意到当我使表格大于放置它的区域时没有滚动条。

下面是一个 Tha 帮助解决问题的示例:

---
title: "Focal Chart (Top)"
output: 
flexdashboard::flex_dashboard:
orientation: rows
---
Row {data-height=500}
-------------------------------------
### Chart 1
```{r}
library(crosstalk)
library(reactable)
```
Row {data-height=500}
-------------------------------------
### With crosstalk filtering
```{r}
cars <- MASS::Cars93[1:20, c("Manufacturer", "Model", "Type", "Price")]
data <- SharedData$new(cars)
bscols(
widths = c(3, 9),
list(
filter_checkbox("type", "Type", data, ~Type),
filter_slider("price", "Price", data, ~Price, width = "100%"),
filter_select("mfr", "Manufacturer", data, ~Manufacturer)
),
reactable(data,groupBy = "Manufacturer")
)
```   
### Without crosstalk
```{r}
reactable(data,groupBy = "Manufacturer")
```

显示了两个表。当在两个表格中折叠雪佛兰时,在右侧的表格(没有串扰过滤的表格(中会出现一个滚动条。但是,在左侧,没有显示滚动条。

如何使我的串扰/可反应可滚动?这个问题可以解决吗?提前非常感谢!

我不认为这是一个完整的答案,但它可能会让你更接近。我夸大了minWidth,以便您可以看到效果。

sticky_style <- list(position = "sticky", left = 0, background = "#fff", zIndex = 1,
borderRight = "1px solid #eee")

crosstalk::bscols(
widths = c(3, 9),
list(
filter_checkbox("type", "Type", data, ~Type),
filter_slider("price", "Price", data, ~Price, width = "100%"),
filter_select("mfr", "Manufacturer", data, ~Manufacturer)
),
reactable(data,columns = list(
Manufacturer = colDef(
style = sticky_style,
headerStyle = sticky_style
)
),  defaultColDef = colDef(minWidth = 300))
)

顺便说一句,@DanielJachetta,我遇到了同样的问题,所以更新了串扰和可反应包,问题消失了。祝你好运。

相关内容

  • 没有找到相关文章

最新更新