This is a migrated thread and some comments may be shown as answers.

Grid data not getting updated on add/remove

2 Answers 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Raziuddin
Top achievements
Rank 1
Veteran
Raziuddin asked on 29 May 2020, 10:11 AM

     I'm using 'kendoGridBinding' input property to feed the data, when i'm adding a new rowData or removing existing rowData (performing push and splice operation on the binded array respectively), the addition/removal of rowData is not getting reflected in the grid, (but when i'm skipping to next page or filtering that item, then the rowData is available.....i.e dataStateChange events).

Any solution for this would be a great help.

Thanks,

Raziuddin.

 

2 Answers, 1 is accepted

Sort by
0
Svet
Telerik team
answered on 02 Jun 2020, 06:29 AM

Hi Raziuddin,

Thank you for the provided details.

Judging by the provided information I can conclude that the Angular change detection isn't triggered when adding/removing an item. Thus the Grid isn't re-rendered and only when clicking the pager buttons the Grid is actually re-rendered and displays the correct view. When using the generic push and splice JavaScript methods they update the value of a given array, but not its reference. One way the Angular change detection mechanism can be triggered is by updating an array by reference. Please check the following example demonstrating such approach:

https://stackblitz.com/edit/angular-tvqmgq?file=app/app.component.ts

I hope this helps.

Regards,
Svetlin
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Raziuddin
Top achievements
Rank 1
Veteran
answered on 08 Jun 2020, 01:36 AM
Thanks Svetlin for your response, this helped me to fix the issue.
Tags
Grid
Asked by
Raziuddin
Top achievements
Rank 1
Veteran
Answers by
Svet
Telerik team
Raziuddin
Top achievements
Rank 1
Veteran
Share this question
or