diff --git a/src/app/components/table/table.ts b/src/app/components/table/table.ts index 7085bd28557..31e1c45fb22 100644 --- a/src/app/components/table/table.ts +++ b/src/app/components/table/table.ts @@ -75,6 +75,7 @@ import { } from './table.interface'; import { Nullable, VoidListener } from 'primeng/ts-helpers'; import { FilterSlashIcon } from 'primeng/icons/filterslash'; +import { platformBrowser } from '@angular/platform-browser'; @Injectable() export class TableService { @@ -1298,14 +1299,16 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable } ngAfterViewInit() { - if (this.isStateful() && this.resizableColumns) { - this.restoreColumnWidths(); + if(isPlatformBrowser(this.platformId)) { + if (this.isStateful() && this.resizableColumns) { + this.restoreColumnWidths(); + } } } ngOnChanges(simpleChange: SimpleChanges) { if (simpleChange.value) { - if (this.isStateful() && !this.stateRestored) { + if (this.isStateful() && !this.stateRestored && isPlatformBrowser(this.platformId)) { this.restoreState(); }