How to change backgroud color of the cell if we have row and cell numbers?

Tags: #<Tag:0x00007efc644cd080>

I have an Ajax response which returns row and cell positions (row = 0, col = [1,2,3]). so the pair would be like [0,1], [0,2], [0,3].

Just see the example below,

cells = [1,2,3]

$.each(cells, function(x, cell){
  hot.setCellMeta(0, cell, 'className', 'error-bg')
});

Style:

.handsontable .error-bg {
  background-color: #ff4c42 !important;
}

The problem is when I manually click on cell then only background appears.

Hey @forchetan01

I propose to add hot.render() after setting up the setCellMeta method. If you add the bg collectively for many cells you just need one render() method, as if you call it too often you may experience lower performance.