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

Problem with ClientGroupHeaderTemplate???

3 Answers 193 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lennart
Top achievements
Rank 1
Lennart asked on 02 Jul 2013, 01:02 PM
Hej

Im trying to use the Kendo Grid for a minor project, where i want to show the column summary in the groupheader. But I cant get it to Work :-(. When i use the Groupfooter, then it works fine.

Anyone got any suggestions?

************************************************************************************
@(Html.Kendo().Grid((IEnumerable<FTEReport>)ViewBag.Test) 
     .Name("grid")
     .Columns(columns =>
{
 columns.Bound(FTEReport => FTEReport.Jan)
.ClientGroupHeaderTemplate("#=sum#");

columns.Bound(FTEReport => FTEReport.Feb)
.ClientGroupFooterTemplate("#=sum#"); 
}
 .DataSource(ds => ds.Ajax()
.Aggregates(aggregates =>
{
aggregates.Add(p => p.Jan).Sum();
aggregates.Add(p => p.Feb).Sum();
 })
.Group(g =>
{
g.Add(c => c.Allocated);
g.Add(c => c.Project);
g.Add(c => c.Department);
})
.Read(read => read.Action("Aggregates_Read", "grid"))
 )
)

Regards
Lennart

3 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 04 Jul 2013, 07:48 AM
Hi Lennart,

I tried to reproduce the problem locally but to no avail – everything is working as expected on our side. Could you please provide runable project where the issue is reproduced? This would help us pinpoint the exact reason for this behavior.

Kind Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Lennart
Top achievements
Rank 1
answered on 04 Jul 2013, 10:03 AM
Hi Vladimir

Thx for your reply!

I have made a standard Kendo Project. (Full Project was to big to attach, so attach the files in the "Controllers","Models" and "Views" Folder).

Other thing Dont look like changes the Group order Works, when .Groupable() is able.


Regard
Lennart
0
Vladimir Iliev
Telerik team
answered on 08 Jul 2013, 10:24 AM
Hi Lennart,

 
From the provided information it seems that the ClientGroupFooterTemplates are not working as the Grid initially is bind to data from the ViewBag in which case the GroupFooterTemplate is used instead. In current scenario I would suggest to always load the Grid data using Ajax requests:

e.g.:

  • Grid code:
    Html.Kendo().Grid<ForeignKeyColumnDemo.Models.FTEReport>()
        .Name("grid")
        .Columns(columns =>
        {
  • Controller: 
    public ActionResult Aggregates_Read([DataSourceRequest] DataSourceRequest request)
    {
        List<FTEReport> test = new List<FTEReport>()
        {
            new FTEReport {Allocated="Preclinical", Project = "SYM01", Department="AD", Role="Scientists",Jan=1,Feb=1,Mar=1,Apr=1,May=1,Jun=1,Jul=1,Aug=1,Sep=1,Oct=1,Nov=1,Dec=1},
            new FTEReport {Allocated="Preclinical",Project = "SYM01", Department="AD", Role="Technicians",Jan=1,Feb=1,Mar=1,Apr=1,May=1,Jun=1,Jul=1,Aug=1,Sep=1,Oct=1,Nov=1,Dec=1},
            new FTEReport {Allocated="Preclinical",Project = "SYM01", Department="CMC", Role="Scientists",Jan=1,Feb=1,Mar=1,Apr=1,May=1,Jun=1,Jul=1,Aug=1,Sep=1,Oct=1,Nov=1,Dec=1},
            new FTEReport {Allocated="Preclinical",Project = "SYM01", Department="CMC", Role="Technicians",Jan=1,Feb=1,Mar=1,Apr=1,May=1,Jun=1,Jul=1,Aug=1,Sep=1,Oct=1,Nov=1,Dec=1},
            new FTEReport {Allocated="Preclinical",Project = "SYM04", Department="CMC", Role="Scientists",Jan=1,Feb=1,Mar=1,Apr=1,May=1,Jun=1,Jul=1,Aug=1,Sep=1,Oct=1,Nov=1,Dec=1},
            new FTEReport {Allocated="Preclinical",Project = "SYM04", Department="CMC", Role="Technicians",Jan=1,Feb=1,Mar=1,Apr=1,May=1,Jun=1,Jul=1,Aug=1,Sep=1,Oct=1,Nov=1,Dec=1}
        };
     
        return Json(test.ToDataSourceResult(request));
    }
  •    
Kind Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Lennart
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Lennart
Top achievements
Rank 1
Share this question
or