Referencing the Handsontable instance
优质
小牛编辑
123浏览
2023-12-01
An implementation of the @handsontable/angular
explaining how to reference the Handsontable instance from the wrapper component.
`, }) class AppComponent { private hotRegisterer = new HotTableRegisterer(); id = 'hotInstance'; hotSettings: Handsontable.GridSettings = { data: Handsontable.helper.createSpreadsheetData(4, 4), colHeaders: true }; swapHotData() { this.hotRegisterer.getInstance(this.id).loadData([['new', 'data']]); } } // app.module.ts import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { HotTableModule } from '@handsontable/angular'; @NgModule({ imports: [ BrowserModule, HotTableModule.forRoot() ], declarations: [ AppComponent ], bootstrap: [ AppComponent ] }) class AppModule { } // bootstrap import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; platformBrowserDynamic().bootstrapModule(AppModule).catch(err => { console.error(err) });