Changing the background color of a cell when editing (custom editor)

Tags: #<Tag:0x00007f8b1d9a0a60>

Hi again :slight_smile:

I am trying to add a background color to a cell when it is being edited. Right now it is ether:

  • Stuck on white when I try to change the background color style
  • Not removing the old value when I apply a class to the input with background color in css

I think that going the first route seems maybe easier so I made this fiddle and was wondering if anyone has an idea on how I can get the background color of the cell to change while I am editing. Thanks!

https://jsfiddle.net/rw3skx4u/1/

Marc

I think the easiest fix is adding background-color to .handsontableInput

.handsontableInput {
background-color: YOUR_COLOR_STYLE;
}

Thank you for your response George. My problem with this technique is that I actually need the background color to change dynamically depending on the row and col index, so I need to either apply a different class or change the background color if the colIndex exists in a dynamic array. I updated this fiddle to show my technique

https://jsfiddle.net/bcwfLue5/

Marc

That’s probably you are using setValue(), which gets called after you edit the value and leave the cell.

Maybe something like this?
https://jsfiddle.net/1o3gwzyr/3

Hey

Here’s Aleksandra.

@george1 thank you for help
@eastmanmarcusc is there anything you miss or have additional questions?