Handsontable data refresh after data post

What is the best way to refresh the handsontable after data is posted/refreshed?
Currently we are doing following after data refresh. Note in below code data is refreshed data and this.hotTable is instance of handsontable that is already initialized on page.

if (this.hotTable) {
this.hotTable.loadData(data);
this.hotTable.render();
return;
}

the problem we are facing is even after the data refresh cell formatting is retained. But the formatting goes away when we scroll the table up and down.
(when a data cell is changed on handsontable we format it using custom renderer by comparing new value with the old value)

Any pointers will be helpful.

Hi @vish
Are you use classes or CSS attributes?
If you add a class to a cell if should not change after scrolling (unless you give them a new class using a scroll event).

If you want to color a cell accordingly to what is the content you can use the cells method to give a certain class.Here’s an example where I set a blue background to cells that contain a number bigger than 7: http://jsfiddle.net/kjujqbp9/. It is not the exact same scenario however it share the same logic.

Actually my question is how should I clear the cell formatting on table refresh. In my case the table formatting is retained even after the table data is refreshed using the below code,

if (this.hotTable) {
this.hotTable.loadData(data);
this.hotTable.render();
return;
}

You could erase cell meta data using afterRender callback. Docs: https://docs.handsontable.com/pro/1.8.0/Hooks.html#event:afterRender