Search code examples
telerikkendo-gridangular5grouping

Kendo for angular grid with grouping manipulate data within group


I am using a kendo for angular grid with grouping, this grid, is it possible to take action only on records within a specific group?

For example, in the group header I have a button and every row has a check box, when the user clicks the button I need to get only the rows with in that group.

Or select all rows in one group ?


Solution

  • In the Grid Header Template we have access to the group property that in turns contains all data items for the respective group under its items property.

    You can pass them to the custom button click handler and proceed accordingly:

    <kendo-grid-column field="Category.CategoryName" title="Category">
                <ng-template kendoGridGroupHeaderTemplate let-group let-field="field" let-value="value">
                <strong>{{field}}</strong>: {{value}} <button class="k-button" (click)="onClick(group)">CLICK</button>
              </ng-template>
            </kendo-grid-column>
    

    EXAMPLE

    For example selecting all items from a group:

    REFERENCE ON SELECTION

    ENHANCED EXAMPLE