I am trying to create some tooltip on a datatable that I build with R. I am very new to this and merely tried to adapt the solution proposed on this post Image popup on hover in DT in R to my situation, but it only provides the possibility to add a hyperlink (below "page_to_replace") or a image tooltip ("image_to_replace") to a whole column. I would like to have a dedicated tooltip for each value of the column, can I do this playing with the CSS config or the JS function I defined ?
Thanks for your help, below the code I use so far
--- in Markdown file
<style type="text/css">
.imgTooltip {
visibility: hidden;
}
.ItemsTooltip:hover .imgTooltip {
visibility: visible;
}
td {
height: 14px;
}
</style>
--- in R script
JScommand <- 'function(data,row,type,meta) {
return "<a class=\'ItemsTooltip\' href=\'page_to_replace\' target=\'_blank\'><img class=\'imgTooltip\' src=\'image_to_replace\'/>" +
data + "</a>";
}'
dt <- DT::datatable(data2,
options = list(autoWidth = TRUE,
columnDefs = list(list(width = '90px', targets = c(0:6)),
list(className = 'dt-right', targets = c(0:6)),
list(targets = 4, render=DT::JS(JScommand))
),
)
)