Unplanned
Last Updated: 19 Nov 2024 15:36 by Hannes
Hannes
Created on: 19 Nov 2024 15:36
Category: TreeView
Type: Feature Request
1
Allow dragging an item outside the TreeView, so I can drop it on my custom target

The TreeView exposes drag events that allow me to detect when the user drags an item and to get the information for the dragged item. I want to be able to drag that item outside of the TreeView and drop it in my custom target.

I am aware that I should handle the custom drop functionality. However, the @ondrop event of my custom target currently does not fire for the tree item: https://blazorrepl.telerik.com/QIblPZvd0412k6U128.

===

ADMIN EDIT

===

For the time being, you may implement the following custom approach:

  • Use the ItemTemplate.
  • Wrap the item text in a container.
  • Enable the draggable attribute of that container. Disable the Draggable parameter of the Treeview, so these properties do not interfere with each other. This approach overrides the built-in behavior of the drag-and-drop functionality, so it cannot be enabled at the same time.  If you want to keep the built-in draggable functionality, implement aa suitable UI that toggles that during runtime.
  • Handle the ondragstart event of the container.

Here is a basic sample showcasing the approach: https://blazorrepl.telerik.com/QIFbvZFA00bHZbsj23.

0 comments