Javascript 获取handsontable表的所有注释

Javascript 获取handsontable表的所有注释,javascript,handsontable,Javascript,Handsontable,我正在使用从excel粘贴数据。我想向一些单元格添加更多信息,一个表示CSS类的字符串。我认为最好的方法是使用插件。 在那里我看到了关于如何添加评论的信息,但我看不到如何阅读评论。 当我尝试时: hot1 = new Handsontable(container, { data: getData(), rowHeaders: true, colHeaders: true, contextMenu: true, comments: true, cel

我正在使用从excel粘贴数据。我想向一些单元格添加更多信息,一个表示CSS类的字符串。我认为最好的方法是使用插件。 在那里我看到了关于如何添加评论的信息,但我看不到如何阅读评论。 当我尝试时:

hot1 = new Handsontable(container, {
    data: getData(),
    rowHeaders: true,
    colHeaders: true,
    contextMenu: true,
    comments: true,
    cell: [
      {row: 1, col: 1, comment: 'Some comment'},
      {row: 2, col: 2, comment: 'More comments'}
    ]
});      

hot1.getData();
我只看到表数据,没有任何关于注释的信息。从文档中可以看出,我可以访问特定单元格以获取其注释,但如果我可以在一个命令中获取所有注释,则没有参考(类似于获取数据的方式)


你有什么想法吗?

我们可以使用
getCellMeta
方法获取所有评论

var comments = [];
hot1.getCellMeta().cell.forEach(allComments);
console.log(comments)

function allComments(element){
  comments.push(element.comment);
}

这是一个工作实例。

@Shlomi L询问是否有一个事件可以在评论更改时绑定到捕获。有。它叫:afterSetCellMeta。以下是一个例子:

afterSetCellMeta:  (row, col, source, val)  => {
       if(source == 'comment'){
                    console.log("[" + row + ", " + col + "]: " + source + " --> " + val);
                        console.log(source); //comment
                        console.log(val); //object containing value
                        this.saveUpdatedComment(val.value);

                    }
  }

这将在更改之前或之后发生。以下是

是否有我可以收听的事件,以便跟踪所有评论更改?如您所见,我已尝试将您的函数添加到“afterChange”事件中,但仅当我对其中一个单元格进行更改时才会调用此事件,而在添加/删除注释时不会调用此事件