Losing information

Tags: #<Tag:0x00007efc64468c48>

I am setting some cells with background color but when I refresh my browser or I click in horizontal scroll bar, my information is lost. Why?

Thank you.

Hi @jelm48

Can you share a code demo showing how you are changing the background color?

Hi Adrian.

This is working:

hot.getCell(i, coords.col).style.backgroundColor = ‘red’

This is not working:

.handsontable .redCell {
background: “#FF0000”;
}

hot.setCellMeta(row, column, ‘className’, ‘redCell’);
hot.render();

Everything works fine, but each time the table is re-rendered (i.e. dragging cells), cells lost their color.

Thanks.

Hi @jelm48

Thank you. This is more preferable way to change the background color:

https://jsfiddle.net/aszymanski/mkv0nzoL/3/

As you can see, even if I manually move the row it will keep the background color. Let me know if that works for you. If not, please modify my example so it will represent your issue.

Hi Adrian.
Is it possible inside afterOnCEllMouseDown hook?

Already answered here: Cell Hook inside afterOnCellMouseDown hook