now, from the server I get comments, and add them so
cell: this.state.comments
Also, I have the function
afterSetCellMeta: ()=>{ this.handleAddComment(comment) }
, in which there is a function that synchronizes comments on the server (this.handleAddComment(comment)) . Now this function works for me after
cell: this.state.comments
but I need it to work only after adding or changing comments
[GH #5388] Сallbacks only when changing comments
Hi @pontiac358
The first conditions you can add (if you do not have it) is
if(key === ‘comment’)
…
}
as it filters out all the meta changes that aren’t comment related.
Then it gets a bit more complicated as you’d need to keep an object of a comment to be able to compare it with a new one.
The only way is to find the comment in this array this.state.comments
and check whether it has changed?
But there can be a lot of comments
cell: this.state.comments
Yes it can. However, we do not have API that can specifically be used to track changed comments. It is a great idea for a feature though. We could also consider adding beforeSetCellMeta
hook as there’s only an ~after hook for that. This could allow us to check if a cell already have a comment.
I have added this idea as a feature request https://github.com/handsontable/handsontable/issues/5388
Hi @pontiac358
I have good news! We’ve just released 8.0.0-beta2 that fixes the mentioned issue. We won’t be closing this ticket now. It will be closed after we release the final 8.0.0 version of Handsontable.
Here’s a full list of changes https://github.com/handsontable/handsontable/releases/tag/8.0.0-beta.2
NPM https://www.npmjs.com/package/handsontable/v/8.0.0-beta.2
All feedback’s appreciated. Thank you for your input.