在 R Shiny DataTable 中,尝试在单击后展开单元格。我怎样才能做到这一点?
In an R Shiny DataTable, trying to expand a cell after it is clicked. How can I do this?
我想在单击 R Shiny 中的 DataTable 中展开一个单元格。我遇到了以下实现,用户可以将鼠标悬停在单元格上以查看其全部内容:
DT::datatable(
bgcDF,
class = "display nowrap",
rownames = FALSE,
escape = FALSE,
options = list(
columnDefs = list(list(
targets = c(4),
render = JS(
"function(data, type, row, meta) {",
"return type === 'display' && data.length > 60 ?",
"'<span title=\"' + data + '\">' + data.substr(0, 60) + '...</span>' : data;",
"}")
)),
这是我需要的前半部分。如果单元格内的数据满足此条件并已缩短,我如何实现单击功能以扩展该单元格内的数据?
谢谢
也许通过请求可编辑的单元格但禁用对所有列的编辑:
library(DT)
dat <- iris
datatable(
dat,
editable = list(
target = "cell",
disable = list(columns = seq_along(dat))
)
)
然后双击单元格时出现单元格内容。
我想在单击 R Shiny 中的 DataTable 中展开一个单元格。我遇到了以下实现,用户可以将鼠标悬停在单元格上以查看其全部内容:
DT::datatable(
bgcDF,
class = "display nowrap",
rownames = FALSE,
escape = FALSE,
options = list(
columnDefs = list(list(
targets = c(4),
render = JS(
"function(data, type, row, meta) {",
"return type === 'display' && data.length > 60 ?",
"'<span title=\"' + data + '\">' + data.substr(0, 60) + '...</span>' : data;",
"}")
)),
这是我需要的前半部分。如果单元格内的数据满足此条件并已缩短,我如何实现单击功能以扩展该单元格内的数据?
谢谢
也许通过请求可编辑的单元格但禁用对所有列的编辑:
library(DT)
dat <- iris
datatable(
dat,
editable = list(
target = "cell",
disable = list(columns = seq_along(dat))
)
)
然后双击单元格时出现单元格内容。