refactor: add 'mobile' and 'gender' columns in client list (#354)

Fixes: #79
This commit is contained in:
Meet Patel
2019-01-03 01:57:01 +05:30
committed by Abhay Chawla
parent f83c262bf7
commit ff77528990
2 changed files with 19 additions and 2 deletions
+7 -2
View File
@@ -14,7 +14,7 @@ import { Observable } from 'rxjs';
export class ClientsComponent implements OnInit {
post: any = [];
private ELEMENT_DATA: any = undefined;
displayedColumns = ['name', 'clientno', 'externalid', 'status', 'office', 'staff'];
displayedColumns = ['name', 'clientno', 'externalid', 'status', 'mobileNo', 'gender', 'office', 'staff'];
dataSource = new MatTableDataSource();
@ViewChild(MatPaginator) paginator: MatPaginator;
@@ -35,8 +35,13 @@ export class ClientsComponent implements OnInit {
res.active = !!res.active;
this.dataSource = new MatTableDataSource(res);
this.dataSource.paginator = this.paginator;
this.dataSource.sortingDataAccessor = (data: any, property: any) => {
switch (property) {
case 'gender': return data.gender.name;
default: return data[property];
}
};
this.dataSource.sort = this.sort;
this.dataSource.sortingDataAccessor = (data, header) => data[header];
})
);
}