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

Implementing Cascading DropDownLists in Editable Grids

Environment

ProductProgress® Kendo UI® for Angular Grid

Description

How can I implement cascading drop-downs in an editable Grid?

Solution

To implement cascading DropDownLists when using the inline editing approach in the Grid, follow the steps:

  1. Use EditTemplateDirective to implement editable DropDownList controls. For more details, check the article on custom editing and validation controls.

  2. Handle the valueChange event of the DropDownList.

    <ng-template kendoGridEditTemplate>
        <kendo-dropdownlist ...
            (valueChange)="onCategoryChange($event)"
        ></kendo-dropdownlist>
    </ng-template>
  3. In the valueChange event handler, update the collection of the desired DropDownList control.

    public onCategoryChange(categoryId: number): void {
       this.names = categoryId ? this.gridData
        .filter((item) => item.CategoryID === categoryId)
        .map(item => item.ProductName) : this.gridData.map((item) => item.ProductName);
    }

The example below demonstrates the cascading functionality in action. If you edit a row and select a category from the DropDownList, the respective names will be loaded in the Name column of the DropDownList control.

Example
View Source
Change Theme:

In this article

Not finding the help you need?