pathDataAccessor(item: any, path: string): any {
return path.split('.')
.reduce((accumulator: any, key: string) => {
return accumulator ? accumulator[key] : undefined;
}, item);
}
//-----------------------
// Get the addresses list
//-----------------------
getData() {
this.isProcessing = true;
this.addressBookService.getAddresses().subscribe((getAddressBookResult: GetAddressBookResult) => {
if (getAddressBookResult !== null) {
this.dataSource = new MatTableDataSource(getAddressBookResult.AddressesContainer);
this.dataSource.sortingDataAccessor = this.pathDataAccessor;
this.dataSource.sort = this.sort;
}
this.isProcessing = false;
});
}