Hover Tool Tip over DataTable value in R?

纵然是瞬间 提交于 2019-12-13 04:34:12

问题


Is there any way to get a hover tool tip working on a shiny data table that has some information, this is possible on graphs but never seen it done before on a data table


回答1:


Yes, like this (no need of Shiny):

library(DT)
datatable(head(iris), 
          options=list(initComplete = JS(c(
            "function(settings){",
            "  var table = settings.oInstance.api();",
            "  var cell = table.cell(2,2);",
            "  cell.node().setAttribute('title', 'TOOLTIP CONTENTS');",
            "}")))
)

table.cell(2,2) means the cell at row 2 and column 2; indices start at 0 in Javascript, and the column of row names is taken into account.



来源:https://stackoverflow.com/questions/53856800/hover-tool-tip-over-datatable-value-in-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!