I want to show tooltip for a cell conditionally For eg if the cell value is not valid as per some rules, then show the text of the rule because of which it's invalid.
var hot = new Handsontable(document.getElementById('example'), {
cells: function(row, col, prop) {
var cellProperties = {};
cellProperties.renderer = 'confirmTradePriceRederer';
return cellProperties;
}
});
function confirmTradePriceRederer(instance, td, row, col, prop, value, cellProperties) {
Handsontable.NumericCell.renderer.apply(this, arguments);
if (value is invalid) {
td.style.color = 'red';
//set tooltip here somehow
}
}
I got it working using comments :
var hot = new Handsontable(document.getElementById('example'), {
cells: function(row, col, prop) {
var cellProperties = {};
cellProperties.renderer = 'confirmTradePriceRenderer';
return cellProperties;
}
});
function confirmTradePriceRederer(instance, td, row, col, prop, value, cellProperties) {
Handsontable.NumericCell.renderer.apply(this, arguments);
if (value is invalid) {
td.style.color = 'red';
cellProperties.comment = 'Test Comment';
}
}
您可以像这样使用td
工具提示:
td.title = 'tooltip'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.