Могу ли я попросить вас указать рабочий код в вопросе? Вы можете увидеть шаги с здесь
здесь - решение вашей проблемы
Таблица компонентов
import { Component, Input, OnInit } from '@angular/core';
import Tabulator from 'tabulator-tables';
import { StorageService } from './storage.service';
export interface IPerson {
id: number,
firstName: string,
lastName: string,
state: string
} // Use Interface for datatypes in Typescripts
@Component({
selector: 'app-table',
template: `<div id="tabulator-div"></div>`, // Html for Tabulator
styles: []
})
export class TabulatorTableComponent implements OnInit {
people: IPerson[] = [];
columnNames: any[] = [];
myTable: Tabulator;
constructor(private storageService: StorageService) { }
ngOnInit() {
this.people = [
{ id: 1, firstName: "John", lastName: "Smith", state: "Ohio" },
{ id: 2, firstName: "Jane", lastName: "Doe", state: "Iowa" },
{ id: 3, firstName: "Bill", lastName: "Great", state: "Hawaii" },
{ id: 4, firstName: "Ted", lastName: "Adventure", state: "Arizona" }
];
const self = this;
this.myTable = new Tabulator("#tabulator-div", {
height: 205, // set height of table (in CSS or here), this enables the Virtual DOM and improves render speed dramatically (can be any valid css height value)
data: this.people, //assign data to table
layout: "fitColumns", //fit columns to width of table (
autoColumns: true,
cellClick: function (e, cell) {
self.storageService.emitShowEdit();
},
});
}
}