New to Kendo UI for Angular? Start a free 30-day trial

Angular Data Grid Tracking Changes

The Kendo UI for Angular Grid tracks changes by the index of the data item while the edited rows are tracked by reference.

The trackBy callback allows you to override the default behavior and provide your own logic of how data item changes will be tracked.

Tracking Changes by Index

The following example demonstrates how to track items only by index. This is especially useful when you want to avoid rerendering the detail row template when changes occur in master row.

<kendo-grid [data]="gridData" [trackBy]="trackByIndex"> </kendo-grid>
public trackByIndex(index: number, item: GridItem): any {
    return index;
}

Tracking Changes by a Data Item Field

To track Grid changes by a data item, use the GridItem which is the second argument of the trackBy callback.

The following example demonstrates how to track changes by items.

<kendo-grid [data]="gridData" [trackBy]="trackByItem"> </kendo-grid>
public trackByItem(index: number, item: GridItem): any {
    return item.data.ProductName;
}