【发布时间】:2017-12-15 19:53:17
【问题描述】:
我想创建一个闪亮的数据表,以突出显示用户鼠标悬停在其上的单元格,以突出显示该点上同一行和同一列中的单元格。它类似于此处显示的内容: https://datatables.net/examples/api/highlight.html
但在这个例子中,整个列都被突出显示,我希望它停在鼠标所在的单元格上。
我见过其他类似问题的问题,比如这个:R shiny mouseover text for table columns。但我不知道它是否过时了,但是那个代码对我不起作用,它只是显示一个普通的数据表。
以下面的代码为例,我该如何实现呢?
library(shiny)
shinyApp(
ui = fluidPage(
DT::dataTableOutput("mtcarsTable")
),
server = function(input, output) {
output$mtcarsTable <- DT::renderDataTable({
DT::datatable(datasets::mtcars[,1:3],
options = list(rowCallback = JS()
)
)
})
}
)
【问题讨论】: