SearchPageTableViewComponent: Add a try catch in ngOnDestroy, ngAfterViewInit to avoid crash in server mode

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@53642 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2018-11-07 09:11:20 +00:00
parent 21ac8fd2f0
commit 49952604f4
1 changed files with 11 additions and 4 deletions

View File

@ -112,21 +112,28 @@ export class SearchPageTableViewComponent implements OnInit, AfterViewInit {
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
$.fn['dataTable'].ext.search.pop();
try{
$.fn['dataTable'].ext.search.pop();
}catch(e){
console.error("An error occured in ngOnDestroy of SearchPageTableViewComponent ", e)
}
}
ngAfterViewInit(): void {
try{
$.fn['dataTable'].ext.search.push((settings, data, dataIndex) => {
if (this.filterData(data, this.searchUtils.keyword, this.filters)) {
console.info("filter true (keyword:"+this.searchUtils.keyword+")");
// console.info("filter true (keyword:"+this.searchUtils.keyword+")");
return true;
}
console.info("filter false (keyword:"+this.searchUtils.keyword+")");
// console.info("filter false (keyword:"+this.searchUtils.keyword+")");
return false;
});
}catch(e){
console.error("An error occured in ngAfterViewInit of SearchPageTableViewComponent ", e)
}
}