寻找一种漂亮的方法来为包含大量文本的列创建可扩展的行
我希望制作一个具有可扩展行的表,这些行在切换时可以保持打开状态。
我想将包含大量文本的列作为可扩展的行详细信息。问题是,当我在可反应中使用“详细信息”来扩展该列时,该列太宽以至于超出屏幕,难以阅读。有没有办法限制可扩展行的最大宽度,使其仅在列所在位置附近扩展?
library(reactable)
library(tidyverse)
library(shiny)
library(tippy)
library(htmltools)
library(webshot)
library(htmlwidgets)
iris2 <- cbind(USArrests[1:32,], mtcars, iris[1:32,])
data2 <- iris2 %>%
mutate(Species = 'This text is long and should only show up entirely when hovering because it is making the shape of my table ugly
and difficult to read when expanded. This text is long and should only show up entirely when hovering because it
is making the shape of my table ugly and difficult to read when expanded.This text is long and should only show
up entirely when hovering because it is making the shape of my table ugly and difficult to read when expanded.
This text is long and should only show up entirely when hovering because it is making the shape of my table ugly
and difficult to read when expanded.')
data <- data2 %>% mutate(Species = word(data2$Species, start =1, end=8, sep = fixed(" ")))
dog2 <- reactable( data,
columns = list(
Species = colDef(details = function(index) {
paste(data2[index, "Species"])
})),
striped = TRUE,
bordered = TRUE)
saveWidget(dog2, "test.html")
任何帮助将不胜感激!谢谢你!
(我发现这个问答很有帮助,但仍然希望有可扩展的行,而不必悬停 R 可反应_如何截断单元格内容并在悬停时显示?)
I was hoping to make a table that has expandable rows that may stay open when toggled.
I wanted to put the columns with long amounts of text as expandable row details. The problem is when I use "details" in reactable to expand that column it's so wide that it goes off-screen making it hard to read. Is there a way to limit the max-width of the expandable row so it only expands approximately where the column is located?
library(reactable)
library(tidyverse)
library(shiny)
library(tippy)
library(htmltools)
library(webshot)
library(htmlwidgets)
iris2 <- cbind(USArrests[1:32,], mtcars, iris[1:32,])
data2 <- iris2 %>%
mutate(Species = 'This text is long and should only show up entirely when hovering because it is making the shape of my table ugly
and difficult to read when expanded. This text is long and should only show up entirely when hovering because it
is making the shape of my table ugly and difficult to read when expanded.This text is long and should only show
up entirely when hovering because it is making the shape of my table ugly and difficult to read when expanded.
This text is long and should only show up entirely when hovering because it is making the shape of my table ugly
and difficult to read when expanded.')
data <- data2 %>% mutate(Species = word(data2$Species, start =1, end=8, sep = fixed(" ")))
dog2 <- reactable( data,
columns = list(
Species = colDef(details = function(index) {
paste(data2[index, "Species"])
})),
striped = TRUE,
bordered = TRUE)
saveWidget(dog2, "test.html")
Any help would be much appreciated! Thank you!
(I found this Q and A to be helpful however was still hoping for expandable rows instead of having to hover R reactable _ how to truncate cell content and display upon hovering? )
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论