I've been attempting to implement a tooltip or title with 2000 characters for a cell within a table that contains an image. I've tried various approaches but haven't been successful in finding a solution. Can someone please assist me? Here is my code snippet for the column:
{
name: 'comments',
index: 'comments',
width: 80,
align: 'center',
resizable: true,
sortable: false,
editable: false,
cellattr: function(rowId, val, rawObject) {
return 'title="' + val + '"'
},
formatter: function(cellvalue, options, rowobject) {
if (cellvalue.length <= 0) {
return cellvalue;
} else {
var image = "<img src='/images/comment.png' />";
return image;
}
}
},
For my second attempt at the code,
{
name: 'comments',
index: 'comments',
width: 80,
align: 'center',
resizable: true,
sortable: false,
editable: false,
formatter: function(cellvalue, options, rowobject) {
if (cellvalue.length <= 0) {
return cellvalue;
} else {
var image = "<img src='/images/comment.png' title='Comments:\n" + cellvalue + "'/>";
return image;
}
}
},
Despite the above code, I still couldn't get the tooltip to display when there are 2000 characters.
I also experimented with the following code:
var image = '<figure><img src='/images/comment.png' title='Comments:\n"+cellvalue+"'/></figure>';
However, this approach is causing the tooltip to load very slowly. Any assistance would be greatly appreciated.