Greetings! I have an MVC 5 app using Telerik UI for MVC 2015.2.624. The key aspects of the grid layout are
@(Html.Kendo().Grid(Model.IssueReportRows.ToList())
.Name("grid")
.HtmlAttributes(new { @class = "suppress-borders sticky-table-header clickable-rows" })
.Pageable(pageable => pageable
.Enabled(ViewData["RenderMode"] != "PDF")
.ButtonCount(ConfigVars.GridPagerButtonCount)
.PageSizes(ChartHelpers.GetPagerChoices(Model.IssueReportRows.Count()))
)
.Sortable(sortable => sortable.AllowUnsort(false))
.Selectable()
.Events(events => events
.DataBound("OnDataBound_Issues")
.Change("OnRowClick")
)
.DataSource(dataSource => dataSource
.Ajax()
.Sort(sort =>
{
sort.Add("ProcedureCategoryName").Ascending();
sort.Add("Sequence").Ascending();
})
.Group(groups => groups.Add(t => t.AuditIssueDescription))
.Aggregates (aggregates =>
{
aggregates.Add(t => t.ProviderName).Count();
aggregates.Add(t => t.ChartsReviewed).Sum();
aggregates.Add(t => t.IssuesFound).Sum();
})
.ServerOperation(false)
.PageSize(ViewData["RenderMode"] == "PDF" ? Model.IssueReportRows.Count() : ChartHelpers.GetPageSize(Model.IssueReportRows.Count()))
)
.Columns(columns =>
{
columns
.Bound(t => t.AuditIssueDescription)
columns
.Bound(t => t.ProcedureCategoryName)
columns
.Bound(t => t.SpecialtyCode)
columns
.Bound(t => t.ProviderName)
.ClientGroupFooterTemplate("Providers: #=count#");
columns
.Bound(t => t.ChartsReviewed)
.ClientGroupFooterTemplate("<
div
class
=
'code-cell suppress-borders'
>#=sum#</
div
>");
columns
.Bound(t => t.IssuesFound)
.ClientGroupFooterTemplate("<
div
class
=
'code-cell'
>#=sum#</
div
>");
})
)
My issue is that I need the grid sorted by ProcedureCategoryName + Sequence. This worked fine until I added the Group and Aggregates - now it sorts by whatever column is specified in Group(). This is a great default, but I have not been able to override the behavior. I have considered creating an extra column that contains a concatenation of ProcedureCategory and Sequence, but I'm hoping there is a better way. If not, please let me know how to put the AuditIssueDescription in the Group Header - that seems challenging as well.
Thanks,
Scott