File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
src/app/core/common-components/entities-table Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 11import {
2- AfterViewInit ,
32 Component ,
43 EventEmitter ,
54 Input ,
@@ -68,7 +67,7 @@ import { EntityDatatype } from "../../basic-datatypes/entity/entity.datatype";
6867 templateUrl : "./entities-table.component.html" ,
6968 styleUrl : "./entities-table.component.scss" ,
7069} )
71- export class EntitiesTableComponent < T extends Entity > implements AfterViewInit {
70+ export class EntitiesTableComponent < T extends Entity > {
7271 @Input ( ) set records ( value : T [ ] ) {
7372 if ( ! value ) {
7473 return ;
@@ -164,8 +163,13 @@ export class EntitiesTableComponent<T extends Entity> implements AfterViewInit {
164163 this . _sortBy = value ;
165164 this . sortIsInferred = false ;
166165 }
166+
167167 _sortBy : Sort ;
168- @ViewChild ( MatSort , { static : true } ) sort : MatSort ;
168+
169+ @ViewChild ( MatSort , { static : false } ) set sort ( sort : MatSort ) {
170+ this . recordsDataSource . sort = sort ;
171+ }
172+
169173 private sortIsInferred : boolean = true ;
170174
171175 /**
@@ -293,10 +297,6 @@ export class EntitiesTableComponent<T extends Entity> implements AfterViewInit {
293297 this . recordsDataSource = this . createDataSource ( ) ;
294298 }
295299
296- ngAfterViewInit ( ) : void {
297- this . recordsDataSource . sort = this . sort ;
298- }
299-
300300 private createDataSource ( ) {
301301 const dataSource = new MatTableDataSource < TableRow < T > > ( ) ;
302302 dataSource . sortData = ( data , sort ) =>
You can’t perform that action at this time.
0 commit comments