How can I add other data from a row to a tooltip?
How can I add other data from a row to a tooltip?
I feel totally new to this, but I have been working on it for days with no luck.
Here are my column definitions I am using. I want to have documentName as the text, and the Document image as the tooltip. But I can only get the data field of that columnto render in the tooltip code. Not the data from another column..
I can render the imagetest in a tooltip in the imagetest column at the end
{
data: "contactDocument.documentName",
"visible": false,
},
{
data: "contactDocument.imagetest2",
"visible": false,
},
{
data: "contactDocument.documentName",
render: function (data, type, row) {
var code = '<object style=" width:300px; height: auto" data="' + row.imagetest2 + '"></object><p class="#dbtooltip" data-toggle="tooltip" title=' + data + '>' + data + '</p>';
return code;
}
data: "contactDocument.imagetest2",
render: function (imagetest2) {
var master = '<span class="mytooltip tooltip-effect-1"> <span class="tooltip-item"> <object style="background:white; width:50px; height: 50px" data="' + imagetest2 + '"></object></span> <span class="tooltip-content clearfix"> <object style=" width:300px; height: auto" data="' + imagetest2 + '"></object></span> </span>'
var code = master;
return code;
}
This question has an accepted answers - jump to answer
Answers
The
columns.render
function has four parameters that can be passed in. The third contains the data for the row. This is therow
parameter you have in line 12. In the render function in line 12 you would userow.contactDocument.imagetest2
to get that data object.Kevin
Oh dear :-)
Thanks for that I forgot the contactDocument field.