Tutorial: Comments

Comments


Edit this page

The Comments plugin makes it possible to easily add, edit and remove comments in Handsontable.

Enabling the plugin

To use the plugin, you'll need to set the comments property to true. It'll enable the plugin and add all the needed context menu items. For example:

let hot = new Handsontable(container, {
  data: Handsontable.helper.createSpreadsheetData(10, 10),
  comments: true
});

Adding the comments via the Context Menu

After you've enabled the plugin, the Context Menu gains a few new items:

  • Add/Edit comment
  • Delete comment
  • Read only comment

I think all of them are pretty self-explanatory.

Setting up pre-set comments

You can also pre-define comments for your table. As comments are stored in the table's/column's/cell's meta data object, you can declare it as any other property of that type.
For example:

cell: [
  {row: 1, col: 1, comment: {value: 'Hello world!'}}
]

In this example we're adding a "Hello world!" comment to a cell at (1,1).

API

You can add, remove and modify most of the comment-related information using the API. For More info, head to our Comments documentation.

Example implementation