TreeView drag and drop disabling not working anymore

2 Answers 33 Views
TreeView
Bryan
Top achievements
Rank 1
Iron
Bryan asked on 11 Jan 2024, 11:56 PM
A while back we created a TreeView with drag and drop. The drag event handler selectively calls e.setStatusClass("k-i-cancel") to disable the drop operation. In the drop event handler,  e.valid used to be set to false when this happened. We are now using Kendo version 2023.3.1010 and e.Valid is always true. Something appears to be broken now. Is there some kind of fix for this? I've tried to implement the same selective disabling logic in the drop event handler as in the drag event handler, but part of the logic involves looking at the value of e.statusClass which doesn't exist in the drop event.
Georgi Denchev
Telerik team
commented on 16 Jan 2024, 03:26 PM

Hi, Bryan,

Could you please share some small sample with me where the problem with the e.valid event data can be seen?

As for the drag/drop event, one approach that you could try is to save the last values of the statusClass in a global variable and then check that variable in the drop event:

// some var outside the component config
let statusClass;

drag: (e) => {
 statusClass = e.statusClass;
},
drop: (e) => {
 if(statusClass) {...}
}

Best Regards,

Georgi

2 Answers, 1 is accepted

Sort by
0
Bryan
Top achievements
Rank 1
Iron
answered on 16 Jan 2024, 05:59 PM | edited on 16 Jan 2024, 06:01 PM

Hi Georgi,

As usual, I had to figure this out for myself. It seems that your most recent documented description of how this works is out of date. The documentation for the drag event is here: drag - API Reference - Kendo UI TreeView - Kendo UI for jQuery (telerik.com) and the note in it says to use the values k-i-insert-up, k-i-insert-down, k-i-insert-middle, k-i-plus, and k-i-cancel for the drag event's e.statusClass value and e.setStatusClass() method. These values don't work for either e.statusClass or e.setStatusClass() anymore. The values that do seem to work are insert-up, insert-down, insert-middle, plus, and cancel. Maybe this all changed when you moved to SVG icons. If so, you can add this to the list of woes that debacle created for your customers. Anyway, you should really update your documentation to accurately describe how it now works.

Thanks,

-Bryan

Georgi Denchev
Telerik team
commented on 19 Jan 2024, 01:52 PM

Hi, Bryan,

I am glad you figured out what the problem was and thank you for sharing the solution!

I'll make a note about the outdated api information and that it needs to be changed. I apologize about the oversight on our end.

Best Regards,

Georgi

0
Bryan
Top achievements
Rank 1
Iron
answered on 16 Jan 2024, 06:19 PM
BTW, I found and resolved a different problem with TreeView drag and drop yesterday as well, but at least it was cosmetic. Sometimes the node expand/collapse button will disappear from the original parent node when you moved a child node to be under a different parent even though the original parent node still has other child nodes. I resolved this by explicitly collapsing and re-expanding the original parent node after the node was moved. You're welcome.
Tags
TreeView
Asked by
Bryan
Top achievements
Rank 1
Iron
Answers by
Bryan
Top achievements
Rank 1
Iron
Share this question
or