Custom renderer: get parent tr node by td

Tags: #<Tag:0x00007f135f4ace18>

Is it possible to get parent tr element and set its style?
td.parentNode is null and td.parentElement is also null. Siblings are also null
i need to highlight a row if cell has a specific value.

 function highlightRowRenderer(instance, td, row, col, prop, value, cellProperties) {
    Handsontable.renderers.TextRenderer.apply(this, arguments);                   
    td.parentNode.style.background = 'yellow';               
}

Thanks in advance.

Hi @maryja.radziuk

the parentNode is accessible http://jsfiddle.net/kt1tsr63/ but as it doesn’t have any style set it will return an error. If you console the td.parentNode you’ll see that you’ll get some null values.

If you are trying to add a background you will need to add it to the td element and if you want the whole row to be yellow just add the condition

if (row === 0) {
      td.className = 'yellow'
    }

(demo http://jsfiddle.net/y1aeeevw/)

If I am missing anything just let me know.

thank you @aleksandra_budnik

You’re welcome.

I assume that we can close the issue.