<p-dataTable [loading]="loading" immutable="false" [value]="populateItems" [responsive]="true" [rows]="5" selectionMode="single" [(selection)]="selectedRow" (onRowSelect)="onRowSelect($event)" [paginator]="true" [pageLinks]="3" [rowsPerPageOptions]="[5,10,20]" class="table table-dynamic" >
<p-header>
<div style="text-align:left">
<p-multiSelect [options]="columnOptions" [(ngModel)]="cols"></p-multiSelect>
</div>
</p-header>
<p-footer><div class="ui-helper-clearfix" style="width:100%"><button type="button" pButton icon="fa-plus" style="float:left" (click)="showDialogToAdd()" label="Add"></button></div></p-footer>
<p-column *ngFor ="let col of cols" [field]="col.field" [header]="col.header" >
<ng-template let-data="rowData" pTemplate type="body">
<span>{{ data[col.field] | customPipe: col.type }}</span>
</ng-template>
</p-column>
</p-dataTable>
Here whenver "populateItems", "cols" value are getting changed, view is not updating. I have used spread operator while changing the values.
this.populateItems = this.data["response"]["data"];
this.populateItems = [...this.populateItems];
this.cols = [...this.cols];
Please help me in this. View is not updating though array values are getting updating with spread operator.
DataTable view is not updating , when variables are getting changed in component.
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Moved to PrimeNG.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 13 guests