GroupHeaderTemplate, using another field from the data set?

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

    Posted 20 Sep 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.

    Lisa

     

     

  2. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2594 posts

    Posted 22 Sep Link to this post

    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.
     
  3. Kendo UI is VS 2017 Ready
Back to Top