Thank you for the additional details. So the event is a cell selection in this case - and we should use the
afterSelectionEnd() hook in Handsontable to get the cell coordinates, on that you can apply the background color.
When it comes to Handsontable rendering cycle, each time a user scrolls and new cells has to appear in the DOM tree or they alter values (edit, paste, autofill, sort, etc.) the table has to call the renderer to repaint the view. Once you set up
getCell() it is not saved and with a new renderer the background color is erased. To set up a permanent metadata that won’t be erased after renderer yo should you
setCellMeta(). However, the
style is not a possible option here.
Possible options? You can attach
className and create it on the fly with your component’s background color or attach custom cell metadata via
setCellMeta() and use a custom cell renderer. Here https://jsfiddle.net/handsoncode/tb7rw0xk/ you can check how to set and use custom cell metadata.