dataGrid not update if collection modify
-
- Posts: 82
- Joined: 21 Mar 2016, 19:42
Hi i have successfully bind datagrid and it works fine but if i change the collection so datagrid cannot update automatically.
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
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?
Do you have paginator? Is it lazy loading datagrid? How do you modify the data?
-
- Posts: 82
- Joined: 21 Mar 2016, 19:42
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.
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.
-
- Posts: 82
- Joined: 21 Mar 2016, 19:42
Please suggest me i am stuck what should i do now.
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
I couldn't replicate so will ask my colleague to try the same, he will give an update.
I couldnt replicate the issue either everything works fine locally.Do you have any configurations? because its updating the list as expected.
-
- Posts: 82
- Joined: 21 Mar 2016, 19:42
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);
<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);
-
- Information
-
Who is online
Users browsing this forum: No registered users and 16 guests