Update names part 2
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort, MatSortable } from '@angular/material/sort';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { Layer } from 'src/app/models/layer.model';
|
||||
|
||||
@Component({
|
||||
selector: 'diunaBI-layers-list',
|
||||
templateUrl: './layers-list.component.html',
|
||||
styleUrls: ['./layers-list.component.scss']
|
||||
})
|
||||
export class LayersListComponent implements OnInit {
|
||||
displayedColumns = ['number', 'name', 'source'];
|
||||
dataSource!: MatTableDataSource<Layer>;
|
||||
|
||||
@ViewChild(MatPaginator) paginator!: MatPaginator;
|
||||
@ViewChild(MatSort) sort!: MatSort;
|
||||
|
||||
constructor(
|
||||
private _http: HttpClient
|
||||
) { }
|
||||
|
||||
async ngOnInit() {
|
||||
this.dataSource = new MatTableDataSource(await Layer.getList(this._http));
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
this.dataSource.sort.sort({ id: 'number', start: 'desc' } as MatSortable);
|
||||
}
|
||||
|
||||
applyFilter(event: Event) {
|
||||
const filterValue = (event.target as HTMLInputElement).value;
|
||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||
}
|
||||
trackByUid(index : number, item : Layer) {
|
||||
return item.id;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user