Hi All,
I have the kendo grid with group as below:
There are 2 groups
(1) Grant Name (want to count how many projects under the grant)
(2) Project Name (want to count how many items under the project)
I cannot get the count to show in each group header by using ClientGroupHeaderTemplate. My code below:
@(Html.Kendo().Grid<Grants.Models.ProjectView>()
.Name("InProgress")
.Columns(column =>
{
column.Bound(c => c.InvoiceDate).Title("Invoice Date").Width(130)
.ClientTemplate("#if (MultipleCategory == 0)"
+ "{#<a onclick=\"windowSingleProcess(#=ProjectReimbursementId#)\"><span style='color:blue; cursor:pointer;'>#= kendo.toString(InvoiceDate,'MM/dd/yyyy') #</span></a>"
+ "#}else"
+ "{#<a onclick=\"windowMultipleProcess(#=ProjectReimbursementId#)\"><span style='color:blue; cursor:pointer;'>#= kendo.toString(InvoiceDate,'MM/dd/yyyy') #</span></a>"
+ "#}#")
.ClientGroupHeaderTemplate("Count: #=count#");
column.Bound(c => c.VendorName).Title("Vendor name");
column.Bound(c => c.InvoiceNumber).Title("Invoice #");
column.Bound(c => c.GrantFundedTotal).Title("Grant Funds Requested").Width(150).Format("{0:c2}").HtmlAttributes(new { style = "text-align:right!important" });
column.Bound(c => c.ContributionFundedTotal).Title("Match").Width(150).Format("{0:c2}").HtmlAttributes(new { style = "text-align:right!important" });
column.Bound(c => c.BudgetCategory).Title("Budget Category");
column.Bound(c => c.ProcessedDate).Title("Process Date").Format("{0:d}").Width(130);
})
.Pageable()
.Sortable()
.Scrollable(s => s.Height("auto"))
.ColumnMenu()
.Mobile()
.DataSource(ds => ds
.Ajax()
.Batch(true)
.GroupPaging(true)
.Model(m => m.Field(x => x.ProjectReimbursementId))
.Group(g =>
{
g.Add(x => x.GrantName);
g.Add(x => x.ProjectName);
})
.Aggregates(ag =>
{
ag.Add(x => x.GrantProjectId).Count();
ag.Add(x => x.ProjectReimbursementId).Count();
ag.Add(x => x.InvoiceDate).Count();
})
.Read(read => read.Action("MyReimbursementInProgress", "ProjectReimbursement"))
)
Thank you for your help.