Skip to content

Commit

Permalink
Fixed #9494 - p-dataView not updating view after [layout] change
Browse files Browse the repository at this point in the history
  • Loading branch information
yigitfindikli committed Mar 11, 2021
1 parent c360422 commit 3b2618e
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/app/components/dataview/dataview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ import {BlockableUI} from 'primeng/api';
})
export class DataView implements OnInit,AfterContentInit,BlockableUI,OnChanges {

@Input() layout: string = 'list';

@Input() paginator: boolean;

@Input() rows: number;
Expand Down Expand Up @@ -142,6 +140,20 @@ export class DataView implements OnInit,AfterContentInit,BlockableUI,OnChanges {

initialized: boolean;

_layout: string = 'list';

@Input() get layout(): string {
return this._layout;
}

set layout(layout: string) {
this._layout = layout;

if (this.initialized) {
this.changeLayout(layout);
}
}

constructor(public el: ElementRef, public cd: ChangeDetectorRef, public filterService: FilterService) {}

ngOnInit() {
Expand Down Expand Up @@ -218,7 +230,7 @@ export class DataView implements OnInit,AfterContentInit,BlockableUI,OnChanges {
}

changeLayout(layout: string) {
this.layout = layout;
this._layout = layout;
this.onChangeLayout.emit({
layout: this.layout
});
Expand Down

0 comments on commit 3b2618e

Please sign in to comment.