Access Global variable within the renderer function

Tags: #<Tag:0x00007f8b24095428>

I have global variable of type boolean isButtonEnabled= false. I would like to make this button enabled when atleast on cell got filled in the excel grid. I have 4 columns and currently I defined renderer for each column to check its null or emptiness and make the button disabled if its empty.

public isButtonEnabled = false; // global variable.

public myCustomTextRenderer(instance, td, row, col, prop, value, cellProperties) {
Handsontable.renderers.TextRenderer.apply(this, arguments);
if( isNullOrUndefined(value) || value.length === 0 ) {
// make my button disabled
} else {
//make my button enabled if the value is not null or not empty
//trying to access global variable here, but not working.
this.isButtonEnabled = true// this is referencing to this funciton context
// I used window.isButtonEnabled also // but not working.
}
retrun td;
}

Hey @kirank.csp

do you use any wrappers? It looks like you do not use vanilla js. Can you share a demo (preferably in StackBlitz) that I can check and debug?