DataTable view is not updating , when variables are getting changed in component.

UI Components for Angular
Post Reply
Posts: 1
Joined: 13 Dec 2017, 08:14

13 Dec 2017, 08:19

<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" >
<div style="text-align:left">
<p-multiSelect [options]="columnOptions" [(ngModel)]="cols"></p-multiSelect>
<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>

Here whenver "populateItems", "cols" value are getting changed, view is not updating. I have used spread operator while changing the values.
this.populateItems =["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.

Posts: 18357
Joined: 05 Jan 2009, 00:21
Location: Cybertron

22 Dec 2017, 09:49

Moved to PrimeNG.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests