@aleksandra_budnik I think I still need help, I prefer adding the class name via Handsontable not through Jquery.
Currently my code looks like this (this doesn’t even highlight the row even though this same logic works on the fiddle I linked to earlier but I’ll fix that myself):
hot.updateSettings({
cells: function(row, col) {
let cellProperties = {};
if(cells[row] && cells[row][col] !== undefined && cells[row][col] != 'inherit') {
cellProperties.renderer = experimentsRenderer;
} else if(transfers[row]) {
let cell = $(hot.getCell(row, col));
cell.addClass('animal-transferred');
let frzTR = $('.handsontable.ht_clone_left').find('table tbody tr');
$(frzTR[row]).find('td').addClass('animal-transferred');
}
return cellProperties;
}
});
Basically what this does is if the if
condition is true
I will use a custom made renderer called experimentsRenderer
, otherwise if my else if
condition is true, I simply want to add a class name to all the td
elements in that row. If both of those are false
then I don’t want to do anything, just render the cell as it was originally intended to be displayed.
Another option I was considering was creating another custom renderer that would do the adding of the class name because it gives me access to the td
but my table contains so many different data types. All of the examples I’ve seen that define a custom renderer does this:
Handsontable.renderers.TextRenderer.apply(this, arguments);
This won’t do because my first column is a checkbox, most are text fields, some are date fields, some are numeric. I tried this and it turned my checkbox fields into a text field that displays true
or false
.