Skip to content

Commit

Permalink
inital commit (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
james-prysm authored Feb 11, 2022
1 parent 86f5a1a commit 650eb65
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Clipboard } from '@angular/cdk/clipboard';
import { SelectionModel } from '@angular/cdk/collections';
import { AfterViewInit, Component, Input, ViewChild } from '@angular/core';
import { AfterViewInit, Component, Input, OnChanges, SimpleChanges, ViewChild } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar';
import { MatSort } from '@angular/material/sort';
Expand Down Expand Up @@ -29,10 +29,10 @@ export interface TableData {
selector: 'app-accounts-table',
templateUrl: './accounts-table.component.html',
})
export class AccountsTableComponent implements AfterViewInit {
export class AccountsTableComponent implements AfterViewInit,OnChanges {
@Input() dataSource: MatTableDataSource<TableData> | null = null;
@Input() selection: SelectionModel<TableData> | null = null;
@ViewChild(MatSort, { static: true }) sort: MatSort | null = null;
@ViewChild(MatSort, { static: false }) sort: MatSort | null = null;

readonly LANDING_URL = '/' + LANDING_URL;

Expand Down Expand Up @@ -62,6 +62,12 @@ export class AccountsTableComponent implements AfterViewInit {
},
];

ngOnChanges(changes: SimpleChanges): void {
if(changes.dataSource && this.dataSource){
this.dataSource.sort = this.sort;
}
}

ngAfterViewInit(): void {
if (this.dataSource) {
this.dataSource.sort = this.sort;
Expand Down

0 comments on commit 650eb65

Please sign in to comment.