stf-datatable
Version:
An Angular 4 dataTable, easily to implement and to costumize. You only need a JSON object and set what properties of your JSON you want to show
49 lines (37 loc) • 1.11 kB
text/typescript
import { DataColumnComponent } from '../data-column/data-column.component';
import {
AfterContentChecked,
AfterViewChecked,
AfterViewInit,
Component,
ContentChildren,
ElementRef,
Input,
OnChanges,
QueryList,
Renderer,
ViewChild,
ViewChildren,
} from '@angular/core';
import { DataTableUtil } from './data-table.util';
export class DataTableComponent implements AfterContentChecked {
data: any;
tableClasses: string;
dataTableProperties: any[] = [];
columns: QueryList<DataColumnComponent>;
constructor(private dataTableUtil: DataTableUtil) {
}
ngAfterContentChecked() {
this.dataTableUtil.columns = [];
this.columns.toArray().forEach(column => {
this.dataTableUtil.addColumn(column);
});
this.dataTableProperties = this.dataTableUtil.buildDataTableProperties(this.data);
}
}