I have previously asked how to colour cells based on colours stored in hidden columns (link). I saw that it is also possible to apply hover information for (DT) tables via t
You could simply add a rowcallback to option paramters to get the toopltip from hidden columns. Something like this:
DT <- datatable(dat,
options = list(columnDefs = list(list(visible=FALSE, targets = 6:10)), rowCallback = JS(
"function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {",
"$('td:eq(1)', nRow).attr('title',aData[1+5]);",
"$('td:eq(2)', nRow).attr('title',aData[2+5]);",
"$('td:eq(3)', nRow).attr('title',aData[3+5]);",
"$('td:eq(4)', nRow).attr('title',aData[4+5]);",
"$('td:eq(5)', nRow).attr('title',aData[6+5]);",
"}")))
[EDIT]:
You can do the same thing in loop as follows:
DT <- datatable(dat,
options = list(columnDefs = list(list(visible=FALSE, targets = 6:10)), rowCallback = JS(
"function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {",
'for(i=0; i<5; i++ ){',
"$('td:eq('+i+')', nRow).attr('title',aData[i+5]);",
'}',
"}")))
Hope it helps!