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

Adding Dirty Flag when Edit Grid Cells


ProductProgress® Kendo UI for Angular Grid


How can I add a dirty flag when cell value is changed in Kendo Grid?


  1. Change the default styles of the TD elements and create custom CSS class for the dirty flag:
.k-grid .k-grid-content td {
    position: relative;

.dirty:before {
    content: "\\e003";
    font-family: WebComponentsIcons;
    font-size: 24px;
    position: absolute;
    top: -12px;
    left: -8px;
    color: red;
  1. Use the CellTemplateDirective to apply the created dirty class conditionally for each column:
<ng-template kendoGridCellTemplate let-dataItem let-column="column">
    <div [class.dirty]="isEdited(dataItem, column)">
        {{ dataItem[column.field] }}
    public isEdited(dataItem, column): boolean {
        if (this.editedItems[dataItem.ProductID]?.length && this.editedItems[dataItem.ProductID]?.indexOf(column.field) > -1) {
            return true;
        } else {
            return false;

The editedItems is a custom object that stores the edited cells per row. The key represents the edited row, while the value is a custom collection which stores the edited column fields:


In cellClose event handler, you can check the value of the FormGroup dirty property. Based on the status, create new key-value pair or update the corresponding row collection:

public cellCloseHandler(args: any) {
  const { formGroup, dataItem } = args;
  if (formGroup.dirty) {
    if (!this.editedItems[formGroup.value.ProductID]) {
      this.editedItems[formGroup.value.ProductID] = [];
    for (let key in formGroup.controls) {
      if (formGroup.get(key).dirty) {
        if (this.editedItems[formGroup.value.ProductID].indexOf(key) === -1) {

The logic used to determine the dirty flag visibility could vary depending on the specific project requirements.

The following example shows the full implementation of the demonstrated approach.

View Source
Change Theme:

In this article

Not finding the help you need?