This is a migrated thread and some comments may be shown as answers.

Can't reorder items

2 Answers 21 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Cristian
Top achievements
Rank 1
Cristian asked on 08 Oct 2020, 06:36 PM

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:

  1. How to enable the drop in between items?
  2. 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.    ))

2 Answers, 1 is accepted

Sort by
0
Cristian
Top achievements
Rank 1
answered on 08 Oct 2020, 06:39 PM

For the record, I tried this like in the demo, but it throws a build error:
"error CS1660: Cannot convert lambda expression to type 'bool' because it is not a delegate type"

1..Editable(editable => editable.Move(move => move.Reorderable(true)))
0
Tsvetomir
Telerik team
answered on 13 Oct 2020, 11:59 AM

Hi Cristian,

The reorderable option of the Kendo UI TreeList is relatively new. It should be available with the latest version that you have specified in the ticket. Is it possible for you to confirm that the utilized version of the project is 2020.3.1007 or at least 2020.3.915? 

 

Regards,
Tsvetomir
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
TreeList
Asked by
Cristian
Top achievements
Rank 1
Answers by
Cristian
Top achievements
Rank 1
Tsvetomir
Telerik team
Share this question
or