I can see that there are ways of creating comments in the cells array before rendering, and using the context menu. But is there a way to create a comment after a change?
I originally tried this:
var errors = [];
var hot = new Handsontable(container, {
data: vendors,
startRows: 1,
afterChange: function(changes, source) {
var row = changes[0][0];
var col = changes[0][1];
errors.push({
row: row,
col: col,
comment: "Error"
})
comments: errors
}
But it seems as though changing the errors object doesn't automatically render the comments. Is there a better way?
Comment can be added on meta object as follows
var hot = new Handsontable(container, {
data: vendors,
startRows: 1,
afterChange: function(changes, source) {
var row = changes[0][0];
var col = changes[0][1];
hot.getCellMeta(row, col).comment = 'Error';
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With