Capture table data(cell value & metadata)

Tags: #<Tag:0x00007f51b5bdeff8> #<Tag:0x00007f51b5bded78>

We are saving handsontable cell vales in DB. So We need to ensure our database stays in sync with the Handsontable data, especially when users insert or delete columns or rows. Is there a method to capture all Handsontable data (both cell values and metadata) in one go, while also selectively capturing only the cells that contain values or metadata?

Any insights or suggestions on how to achieve this efficiently would be greatly appreciated.

Hi @srioviyanp

In general for such requirements we suggest to use the afterChange hook that contains the information about any change within the table: https://handsontable.com/docs/javascript-data-grid/api/hooks/#afterchange It will be useful to get any change in the value but for meta data changes you will need to use another hook, getCellMeta https://handsontable.com/docs/javascript-data-grid/api/core/#getcellmeta

Those two hooks should be enough to get all the data you need.

There will be thousands of cell’s index will get change when insert/delete column/row. So i would like to know is there any out-of-box method which gives table data(including value and metadata together)?

@srioviyanp

There’s no single method available to achieve this. The two I described above have to be used to get that data.

AfterChange event is not getting triggered when insert/delete column. does it require any specific config?

@srioviyanp

For this events you would need to use those hooks:

Great! I have built logic based on those hooks only. thought of checking for better solution. Thank you!

@srioviyanp

Thank you for the update. I’m glad I could help. I will close this topic then.

1 Like