GroupHeaderTemplate, using another field from the data set?

2 posts, 0 answers
  1. Lisa
    Lisa avatar
    37 posts
    Member since:
    May 2011

    Posted 20 Sep 2016 Link to this post

    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.




  2. Iliana Nikolova
    Iliana Nikolova avatar
    2622 posts

    Posted 22 Sep 2016 Link to this post

    Hi Lisa,

    Please check the fields which can be used in the groupHeaderTemplate property of Kendo UI Grid:
    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:

    Iliana Nikolova
    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
Back to Top