Hello, I am trying to reorder/sort items in my TreeList but it doesn't seem to work like this demo:
https://demos.telerik.com/aspnet-core/treelist/dragdrop
Every time I drag an items it looks like i can only add it to a parent but I can't drop it in a new position (see attached video).
So I have two questions:
- How to enable the drop in between items?
- How to disable to parent functionality (I only need to allow the reordering on the same level)
Here's the code:
01.
@(Html.Kendo().TreeList<
SchoolInfoSectionViewModel
>()
02.
.Name("treelistschool")
03.
.Columns(x =>
04.
{
05.
x.Add().Field(e => e.SectionId).Title(" ")
06.
.Template($"<
div
class=\"d-inline-flex\" role=\"group\">" +
07.
$"<
a
href=\"../SchoolInfo/Edit/#= SectionId #\" class=\"btn btn-sm btn-secondary mr-1\">" +
08.
$"<
i
class=\"fa fa-pencil\"></
i
></
a
>" +
09.
$"<
span
class=\"text-muted mr-1\">|</
span
>" +
10.
$"<
a
href=\"\\#\" data-val=\"#= SectionId #\" class=\"btn btn-sm btn-danger mr-1\" data-toggle=\"modal\" data-target=\"\\#deleteModal\">" +
11.
$"<
i
class=\"fa fa-trash\"></
i
></
a
></
div
>")
12.
.Width(120)
13.
.Filterable(false);
14.
15.
x.Add().Field(e => e.SchoolInfoContent.ContentTitle).Title("Section Title")
16.
.Template($"<
a
href=\"../SchoolInfo/Detail/#= SectionId #\" >#= SchoolInfoContent.ContentTitle #</
a
>");
17.
18.
})
19.
.Editable(editable => editable.Move(true))
20.
.Reorderable(true)
21.
//.Filterable()
22.
//.Sortable(true)
23.
//.Toolbar(toolbar => toolbar.Search())
24.
//.Toolbar(t => t.Custom().Name("btncreateschool").Text("+ Create new section"))
25.
//.Search(x => x.Field(f => f.SchoolInfoContent.ContentTitle))
26.
.DataSource(x =>
27.
x.Read(read => read.Action("AllSchool", "SchoolInfo"))
28.
.Model(m =>
29.
{
30.
m.Id(f => f.SectionId);
31.
m.ParentId(f => f.ReportsTo).Nullable(true);
32.
m.Expanded(false);
33.
m.Field(f => f.UpdatedBy);
34.
m.Field(f => f.SchoolInfoContent.ContentTitle);
35.
m.Field(f => f.UpdatedOn);
36.
m.Field(f => f.IsPublished);
37.
})
38.
))