I am new to this and am trying to populate a DataView (https://www.primefaces.org/primeng/showcase/#/dataview).
It works fine on page load but it is not updating to show new data when the route changes and updates the source data object. Basically an ID is passed in the route / url and is the passed ID for a DB query that then populates the DataView.
Code: Select all
@Output() dataViewData: any[];
constructor(
private route: ActivatedRoute
) {}
ngOnInit(): void {
this.route.params.subscribe((params) => {
this.selectedID = params.id;
this.getData(this.selectedID);
});
}
this.getData(id){
const data = 'http GET perfmormed here';
this.dataViewData = data;
}
Code: Select all
<app-items [data]="dataViewData"></app-items>
<p-dataView #dv [value]="dataViewData" [paginator]="true" [rows]="9" filterBy="Title" [sortField]="sortField"
[sortOrder]="sortOrder" layout="grid">
...
</p-dataView>
Thanks in advance!