This is a migrated thread and some comments may be shown as answers.

GroupHeaderTemplate, using another field from the data set?

1 Answer 1587 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lisa
Top achievements
Rank 1
Lisa asked on 20 Sep 2016, 04:35 PM

Hi, I have a situation where the field in a grid column is an ID, we display a description using the template.  In this case, it's a grade level, and for example "0" is "Kindergarten".  We want to display Kindergarten instead of 0 if possible in the group header, it's clearer to our users.

Here is the current column definition.  I've tried different things using a function, haven't found the right code, if it's even possible.

{ field: "GradeLevelId", title: "Grade Level", width: 120, template: function (dataItem)
    {
    return dataItem.GradeLevel;
    }
    , aggregates: ["count"],
    groupHeaderTemplate: "Grade Level: #=value# - Count: #=count#"
},

What I would like it to have the GradeLevel field show somewhere in the GroupHeaderTemplate instead of/or even in addition to, the value that is the GradeLevelID.

Thanks for any help.

Lisa

 

 

1 Answer, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 22 Sep 2016, 11:35 AM
Hi Lisa,

Please check the fields which can be used in the groupHeaderTemplate property of Kendo UI Grid:

http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-columns.groupHeaderTemplate
 
Although it is not possible to access row values within the groupHeaderTemplate directly, you could use the Grid's DataSource for getting reference to particular values. For your convenience here is a basic example: 

http://dojo.telerik.com/@Iliana/erogU

Regards,
Iliana Nikolova
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
Tags
Grid
Asked by
Lisa
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Share this question
or