Unable to highlight the row after deselect the table using setCellMeta

Tags: #<Tag:0x00007f8b25761a58>

I have a requirement say ,

  1. I add a new row into the table (assume this row has errors) and table is part of child component
  2. I have a button (b1) in the main component which when I clicked, i find which row to be highlighted
  3. When b1 is clicked, I listed in childcomponent’s after deselect(event) method to find the row to be highlighted and apply using this.hot.setCellMeta(i,0, ‘className’ ‘redcolor’)
    But the new styles are not rendering.
    Could you provide us an example or do you suggest any other event to be listened to after we move out from table. I tried afterLoad, still doesn’t work
    afterDeselect(event) {
    if (inValidRows.length > 0) {
    for (let i = 0; i < this.hot.countCols(); i++) {
    inValidRows.forEach(element => {
    this.hot.setCellMeta(element + 1, i + 1, ‘className’, ‘redcolor’);
    this.hot.render();
    });
    }
    }
    }

Hi @krish

how and where do you set the redcolor settings? Usually if you define a class you should be more specific when it comes to Handsontable as by default it changes some of the CSS settings. You should point it out as .handsontable .redcolor. Also if you use Angular you have to place the class settings in the main .CSS file, not in the component .

Hi,
I was overriding the afterdeselect method and applying the style.

Is that working for you now, @krish?

No, it isn’t

Can you share a demo where this issue can be replicable? I’ll test it and try to find a solution.