The issue you are having is because in the context of the rowFormatter
this
is referring to the Tabulator table object.
So you could either use an arrow function when defining the row formatter callback, which would preserve the scope of the parent:
rowFormatter:(row) => {
}
or you could store the scope of this
in a different variable, lets call it self
and then use that in the callback:
private createTable(element: HTMLDivElement,jsonFileContents, schemaId: string): Tabulator {
var self = this;
var table = new Tabulator(this.tab, {
rowFormatter:function(row) {
self.createTable();
}
});
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…