My requirements say that I must sort the items in the treelist alphabetically. This includes the child nodes. This control uses a "flat hierarchy" because it is a table with parent references. When I sort the source data alphabetically it doesn't seem to change anything. I need to short by Group.Name:
<
script
id
=
"icon-template"
type
=
"text/x-kendo-template"
>
<
div
class
=
'group-icon'
style
=
'background-image: url(@Url.Content("#: ImageUrl #"));'
></
div
>
<
div
class
=
'group-name'
>#: Name #</
div
>
</
script
>
@(Html.Kendo().TreeList<
Group
>()
.Name("treelist")
.Columns(columns =>
{
if (!Model.GetBoolValue(Glossary.Models.Group.Keys.IsHideDetails))
{
columns.Add().Command(c => { c.Custom().Text("Details").Name("detailButton").ClassName("detailButton").Click("goDetail"); }).Width(Glossary.Portal.ButtonWidth);
}
if (Model.GetBoolValue(Glossary.Models.Group.Keys.IsHideMeta))
{
columns.Add().Field(e => e.Name).TemplateId("icon-template").Width(225);
}
else
{
columns.Add().Field(e => e.Name).TemplateId("icon-template");
}
})
.DataSource(dataSource => dataSource
.ServerOperation(false)
.Read(read => read.Action("IndexJson", "Groups").Data("getData"))
.Model(m =>
{
m.Id(f => f.Id);
m.ParentId(f => f.ParentId);
m.Expanded(true);
m.Field(f => f.Name);
}).Events(events => events.Error("onError"))
).Events(evt => evt.DataBound("treeListBound"))
)