dataGrid not update if collection modify

UI Components for Angular
Post Reply
microdeveloper
Posts: 82
Joined: 21 Mar 2016, 19:42

29 Apr 2016, 20:27

Hi i have successfully bind datagrid and it works fine but if i change the collection so datagrid cannot update automatically.

cagatay.civici
Prime
Posts: 18113
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

29 Apr 2016, 20:48

I couldn't replicate in my local test and checked out the code, change detection seems to be implemented properly.

Do you have paginator? Is it lazy loading datagrid? How do you modify the data?

microdeveloper
Posts: 82
Joined: 21 Mar 2016, 19:42

29 Apr 2016, 21:02

Modifications work perfectly if i update any record or etc, But when i add new record in the list so then Datagrid does not update.
This is my method

let cpt: Cptcode = new Cptcode();
cpt.code = event.data.Code;
cpt.description = event.data.Description;
this._CPTCode.push(cpt);

in above _CPTCode is the list which is binded to datagrid.

microdeveloper
Posts: 82
Joined: 21 Mar 2016, 19:42

02 May 2016, 02:23

Please suggest me i am stuck what should i do now.

cagatay.civici
Prime
Posts: 18113
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

02 May 2016, 07:32

I couldn't replicate so will ask my colleague to try the same, he will give an update.

User avatar
DarthMaul
Posts: 583
Joined: 23 Nov 2015, 21:20

02 May 2016, 08:43

I couldnt replicate the issue either everything works fine locally.Do you have any configurations? because its updating the list as expected.

microdeveloper
Posts: 82
Joined: 21 Mar 2016, 19:42

02 May 2016, 14:06

Component Code is following.

<p-dataGrid style="background-color:white;" [(value)]="_CPTCode" [columns]="3">
<template #cpt>
<div class="divLink ui-grid ui-grid-responsive animated fadeIn" style="padding:0;">
<div class="ui-grid-row" (click)="OnClickCPT(cpt)">
<div class="ui-grid-col-3">
{{cpt.code}}
</div>
</div>
</div>
</template>
</p-dataGrid>

On Add Method

let cpt: Cptcode = new Cptcode();
cpt.code = event.data.Code;
cpt.description = event.data.Description;
this._CPTCode.push(cpt);

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest