Completed
Last Updated: 22 Jun 2021 14:20 by ADMIN
Balazs
Created on: 27 Sep 2018 16:06
Category: Grid
Type: Feature Request
1
make groupIndex available inside the groupHeaderTemplateDirective (and footer)
when expanding a group, inside the expand event (function) we do have access to the groupIndex.

but groupIndex is not available inside the groupHeader(Footer)Template itself.

we need that groupIndex, so we can get the parent items (groups) to the group that is expanded.
2 comments
ADMIN
Martin Bechev
Posted on: 22 Jun 2021 14:20

Hi Balazs,

The developer can use the index field provide by the template context to capture the current group index:

https://www.telerik.com/kendo-angular-ui/components/grid/api/GroupHeaderTemplateDirective/#toc-groupheadertemplatedirective

Regards,
Martin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Balazs
Posted on: 28 Sep 2018 14:54
From SUPPORT: We already added the desired functionality. The groupHeaderTemplateDirective will export the groupIndex as well. Indeed, it will take some time for the change to take effect as some internal checks need to be passed before we can release the new version.

You can follow the changelog article of the grid for latest versions updates:
https://www.telerik.com/kendo-angular-ui-develop/components/grid/changelog/


I already had a way to find the item in the hierarchy via the available dataItem in the header:

    private getNodePathArrayToGroupViaGroupDataItem(gridItems: any[], groupDataItem: any, parentPath: Array<{ field: string, value: any }> = []): Array<{ field: string, value: any }> {

        let currentNodeItems = gridItems;

        for (let nodeItem of currentNodeItems) {
            if (this.isAggregate(nodeItem)) {
                let thisPath = parentPath.concat({field: nodeItem.field, value: nodeItem.value});

                let itemFound = nodeItem === groupDataItem;
                if (itemFound)
                    return thisPath;

                let innerResult = this.getNodePathArrayToGroupViaGroupDataItem(nodeItem.items, groupDataItem, thisPath);
                if (innerResult)
                    return innerResult;
            }
        }

        return null;
    }