2019-06-14 03:58:30 +00:00
|
|
|
import {Component, OnInit, ViewChild} from '@angular/core';
|
|
|
|
import { MatPaginator } from '@angular/material/paginator';
|
|
|
|
import { MatSort } from '@angular/material/sort';
|
|
|
|
import {TableListDataSource} from './table-list-datasource';
|
|
|
|
import {Table} from '../../core/table';
|
|
|
|
import {ActivatedRoute} from '@angular/router';
|
2019-06-13 19:02:34 +00:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-table-list',
|
|
|
|
templateUrl: './table-list.component.html',
|
|
|
|
styleUrls: ['./table-list.component.css']
|
|
|
|
})
|
2019-06-14 03:58:30 +00:00
|
|
|
export class TableListComponent implements OnInit {
|
|
|
|
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
|
|
|
@ViewChild(MatSort, { static: true }) sort: MatSort;
|
|
|
|
dataSource: TableListDataSource;
|
|
|
|
list: Table[];
|
|
|
|
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
|
|
|
displayedColumns = ['name', 'isActive'];
|
2019-06-13 19:02:34 +00:00
|
|
|
|
2019-06-14 03:58:30 +00:00
|
|
|
constructor(private route: ActivatedRoute) {
|
|
|
|
}
|
2019-06-13 19:02:34 +00:00
|
|
|
|
2019-06-14 03:58:30 +00:00
|
|
|
ngOnInit() {
|
|
|
|
this.route.data
|
|
|
|
.subscribe((data: { list: Table[] }) => {
|
|
|
|
this.list = data.list;
|
|
|
|
});
|
|
|
|
this.dataSource = new TableListDataSource(this.paginator, this.sort, this.list);
|
|
|
|
}
|
2019-06-13 19:02:34 +00:00
|
|
|
}
|