Renderer apply on cell with dropdown type

Hi Handsontable support,

I have noticed that the small arrow which appears in a dropdown type cell is not appearing anymore as soon as renderer is apply to the cell itself. See example https://jsfiddle.net/Lotchi/czj6vnce/

Is it possible to keep the arrow anyway?

Thanks in advance,
Regards,
Thomas

Hi @luexternaltweyrich

in the line 110 you are telling Handsontable that you want to define the cells as text type.
If you wish only to change a background to a cell I propose changing line 136 - the one when you’re adding a renderer to

cellProperties.className = 'myGreenBg';

plus add the class to the CSS section

.handsontable .myGreenBg {
    background: #007833;
}

demo: https://jsfiddle.net/handsoncode/sxu974zg/

Also, I have found that in line 135 you may have a bug. As I assume you want to show the background only for the second column (property year). If so, you should change the line 135 to

if (prop === 'year')
(triple equal sign)

Hi Aleksandra,

Thanks for your reply, this will for sure help me.
Indeed there was a small bug :slight_smile:
kr
Thomas

Hi @aleksandra_budnik,

Sorry I have been a bit quick in my answer and in my exemple.
Actually I want to apply a renderer because I want to change the background of the cell according to the value of another cell in the same line. This is not possible using cell properties like in your example I guess.

kr
Thomas

Can you share all conditions for cells/rows/columns? I will help you to organize the renderer.

Hi,

Here is an example: https://jsfiddle.net/Lotchi/1wa4ekuy/
For one specific car I want to have all other column in green.

kr
Thomas

In this case you are adding the myRenderer only for dropdown columns so you can just change the line 112 that uses TextRenderer to AutocompleteRenderer and it will work.

Updated demo https://jsfiddle.net/handsoncode/oo9y90d3/

This is exactly what I need! Great!

Thank you for your help once again.

kr
Thomas

You’re welcome, Thomas. I keep my fingers crossed for further development.