Hi,
I don't know if I'm doing something wrong but I have a page with a grid that is populated with IQueryable<Grant> data initially using BindTo and are ajax bound with aggregates. When the page loads, the aggregate total (sum) shows 0. As soon as I sort or page the aggregates are populated so I'm not sure what's going on.
My grid is as follows:
Any suggestions?
Thank you.
David A.
I don't know if I'm doing something wrong but I have a page with a grid that is populated with IQueryable<Grant> data initially using BindTo and are ajax bound with aggregates. When the page loads, the aggregate total (sum) shows 0. As soon as I sort or page the aggregates are populated so I'm not sure what's going on.
My grid is as follows:
@(Html.Kendo().Grid<Grant>()
.Name(
"gd-gt"
)
.BindTo(Model.Grants)
.Columns(c =>
{
c.Bound(g => g.GrantDate).Width(90).Format(
"{0:MM/dd/yyyy}"
).HtmlAttributes(
new
{ style =
"text-align:center;"
});
c.Bound(g => g.ResultText).Title(
"Special Result"
).Sortable(
false
);
c.Bound(g => g.Amount).Format(
"{0:C2}"
).Width(80).HtmlAttributes(
new
{ style =
"text-align:right;"
})
.ClientFooterTemplate(
"#=kendo.toString(sum, 'C2')#"
).FooterHtmlAttributes(
new
{ style =
"text-align:right;"
});
})
.Pageable()
.Sortable(s => s.AllowUnsort(
false
))
.DataSource(ds => ds
.Ajax()
.ServerOperation(
true
)
.PageSize(5)
.Aggregates(aggregates =>
{
aggregates.Add(g => g.Amount).Sum();
})
.Model(model =>
{
model.Id(m => m.GrantId);
})
.Read(read => read.Action(
"LoadGrants"
,
"Home"
,
new
{ caseId = caseId }))
.Sort(s => { s.Add(g => g.GrantDate).Descending(); })
))
)
Thank you.
David A.