Access to ng component properties from inside renderer
is there any way to access to the properties defined in the host component from inside of a renderer function ? I tried to use the keyword "this" but it always is undefined.
//a random property inside an angular component
public cellStyles:array<any>() = [];
//the render funtion defined for the column private columns: any[] = [ {
// data: 'name',
// renderer: this.styleRender,
// }]
styleRender(instance, td, row, col, prop, value, cellProperties) {
Handsontable.renderers.TextRenderer.apply(this, arguments);
this.cellStyles// <- "this" (which is a reference to the host component is always undefined in this context)
}
Thanks, team!
Hi All. Tim Here.
I was checking in to see if a solution was found for this. I'm currently working on a project and need exactly this.
"A real man doesn't give way to anger & discontent & such a person has strength, courage & endurance unlike the angry and complaining." - Marcus Aurelius
Just define your styleRender method like this:
styleRender = (hotInstance, td, row, column, prop, value, cellProperties) => { console.log(this.yourComponentVariableName); Handsontable.renderers.TextRenderer.apply(this, [hotInstance, td, row, column, prop, value, cellProperties]); }
Best regards