I am creating a Kendo grid with a datetime column. I want to group the date column so that it is descending. The latest date is on top and the earliest on the bottom. I have come across this line of code
groups => groups.AddDescending(true)
But it says that there is no definition for AddDescending. How do I change the grouping? Here is how my grid is defined.
@(Html.Kendo().Grid<
LogModel
>()
.Name("Log")
.Columns(columns =>
{
columns.Bound(m => m.dateTimeChangeDate)
.Title("Date and Time")
.ClientTemplate("#= ChangeDate#")
.ClientGroupHeaderTemplate("#= formatUtcDateToLocal(value, 'MM/DD/YYYY')#")
.Width("12%");
columns.Bound(m => m.Component)
.Title("Component")
.Width("8%")
.Filterable(filterable => filterable
.UI("componentFilter")
.Extra(false)
.Operators(operators => operators
.ForString(str => str.Clear()
.Contains("Contains")
))
);
columns.Bound(m => m.Action)
.Title("Action")
.Width("15%")
.Filterable(filterable => filterable
.UI("actionFilter")
.Extra(false)
.Operators(operators => operators
.ForString(str => str.Clear()
.Contains("Contains")
))
);
columns.Bound(m => m.Changer)
.Title("Changer")
.Width("10%");
columns.Bound(m => m.Identifier)
.Title("On")
.Width("15%");
columns.Bound(m => m.OldValue)
.Title("Old Value")
.Width("20%");
columns.Bound(m => m.NewValue)
.Title("New Value")
.Width("20%");
})
.Filterable()
.Selectable()
.Sortable()
.Groupable()
.Resizable(resize => resize.Columns(true))
.ToolBar(toolbar =>
{
toolbar.Template(
@<
text
>
<
a
class
=
"k-button k-button-icontext k-grid-excel"
href
=
"#"
><
span
class
=
"k-icon k-i-excel"
></
span
>Export to Excel</
a
>
<
span
style
=
'padding-left:35%;font-weight:bold;padding-top:7px'
>@ViewBag.ProjectNumber</
span
>
<
span
style
=
'float:right;font-weight:bold;padding-top:7px'
>Total: <
span
id
=
"change-log-record-count"
>@ViewBag.ChangeLogRecordAmount</
span
> records</
span
>
</
text
>
);
})
.Excel(excel => excel.AllPages(true).FileName(@ViewBag.ChangeLogType + " Change Log " + @ViewBag.ProjectNumber + ".xlsx").Filterable(true))
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(p => p.Id);
})
.Read(read => read.Action("FetchChangeLogData", "ChangeLog")
.Data("buildParam"))
)
.Events(e => e.FilterMenuInit("resizeFilter")
.ExcelExport("modifyFormatForExcel")
.DataBound("preselectCustomFilter"))
.ClientDetailTemplateId("change-log-details-template")
)