GRID : Group by column type object

1 Answer 519 Views
Grid
carlos
Top achievements
Rank 1
Veteran
carlos asked on 28 Jul 2021, 10:56 AM

Hi all,

We are trying grouping by column type object , for this, we use this code:

group: function(e) {
    if (e.groups.length) {
        var isNestedGrouped;
        
        e.groups.map(function(x){
            if(x.field == "type"){
                isNestedGrouped = true;
            }
        })
        
        if(isNestedGrouped){
            e.preventDefault()
            var newGroups = [];
            this.dataSource.group().forEach(function(x){
                if(x.field != "type"){
                    newGroups.push(x)
                }
            })
            newGroups.push({field:"type.name"})
            this.dataSource.group(newGroups)
        }   
    }
}
With this code, the grouping work correctly, but the text appears in header group template it's not we need.
In the grid we can see the name of field and his value, but we want see the title of the column.

How we can do it?


Thank you in advance

1 Answer, 1 is accepted

Sort by
0
Patrick | Technical Support Engineer, Senior
Telerik team
answered on 30 Jul 2021, 03:18 PM

Hello Carlos,

One way in which you can manipulate the group header is to configure the columns.groupHeaderTemplate.  

    columns: [
        { field: "name" },
        {
            field: "Type",
            title: "Tipo",
            groupHeaderTemplate: "Tipo: #: value #",
        },
        { field: "year", aggregates: ["max"] }
    ],

Currently, the columns.groupHeaderTemplate does not contain the title field to utilize.  That being said, I have created a feature request with a vote on your behalf asking for this functionality to be added.  Please feel free to follow the request for potential updates and add any comments with the feature request.

Regards,
Patrick
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid
Asked by
carlos
Top achievements
Rank 1
Veteran
Answers by
Patrick | Technical Support Engineer, Senior
Telerik team
Share this question
or