Dynamic styling at cells

Tags: #<Tag:0x00007efc65113f38>

I am making a real-time table
I want my table to change the cell’s style depending on its data

I gave ‘cells’ option to the table with function to change its style depending on its data
but it works only at the first

pls help me to implement the dynamic styled table
Thank you very much

Hi @likethis91

Here is an example using cells and attaching a className based on a value https://jsfiddle.net/r6bLco3v/4/

Let me know if it meets your requirements.

thank you. i figured it out with your ‘getDataAtCell’

my code was :

let cellProps = {};

let data = this.instance.getData()[r][0];

if (['실패','전원불량','소등','점멸','모순','열림'].indexOf(data) != -1) {

    cellProps.renderer = function (inst, td, row, col, prop, v, cellProps) { 

    Handsontable.renderers.TextRenderer.apply(this, arguments);

    td.style = `

        font-weight:bold;

        color:red;

    `;

}; 
return cellProps

and now :

let cellProps = {}

let content = this.instance.getDataAtCell(r, c);

if (['실패','전원불량','소등','점멸','모순','열림'].indexOf(content) != -1) {

    cp.className = 'htCenter htErr'

}

return cellProps 

my ‘Before code’ with ‘getData’ works with ‘loadData’ and not with ‘setDataAtCell’.
with ‘getDataAtCell’ it works!

Thank you for the update, @likethis91