Retrieving additional values in ClientGroupHeaderTemplate

2 posts, 0 answers
  1. Iain
    Iain avatar
    1 posts
    Member since:
    Sep 2012

    Posted 25 Mar 2015 Link to this post

    Hello,

    I have a grid that I'm grouping by the Value of a KeyValuePair property in my Model. I'm able to access the GroupedBy value (using "#= value#") in the ClientGroupHeaderTemplate, but I also need access to the Key (represented in the code below as "#= key#". Is it possible to do this?

    @(grid.Name(Model.GridId)
    .HtmlAttributes(new { @class = "kendo-grid", data_get_url = Url.Action("GetStaticPermissions", "PermissionSetRecord", new { permissionSetId = Model.PermissionSetId }) }) 
    .DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action(Model.ReadAction, "PermissionSetRecord", new { category = Model.Category, permissionSetId = Model.PermissionSetId }))
            .Group(groups => groups.Add(permission => permission.PermissionGroupInfo.Value)))
        .Columns(columns =>
        {
            columns.Bound(d => d.PermissionGroupInfo.Value)
                .Hidden(true)
                .ClientTemplate("")
                .ClientGroupHeaderTemplate(GetTemplateTitle().ToHtmlString());
            columns.Bound(d => d.DisplayName)
                .Title(Saturn.Resources.Admin.Security.Permission);
            columns.Template(@<text></text>)
                .Title(Saturn.Resources.Admin.Security.AllowQuestion)
                .Width(100)
                .ClientTemplate(Html.Partial("Permissions/_Toggle", Model).ToHtmlString());
        }))

    @helper GetTemplateTitle()
    {
        <span>
              #= value# 
             
             
    // I want access to the key of my property here
              #= key#
        </span>    
    }

    Thanks.








  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 27 Mar 2015 Link to this post

    Hello Iain,

    I posted a reply in the other thread that you opened on the same subject, for reference I will paste the reply here:

    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    The only item that I assume you are searching for is called "field". Try to use 

    #= field # inside your template and see if it suits your needs.

    I hope this helps.

    Kind Regards,
    Petur Subev
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top