kendo TreeList event drop element is missing or not in correct order

0 Answers 119 Views
Drag and Drop TreeList
Kok Ho
Top achievements
Rank 1
Kok Ho asked on 27 Jan 2023, 08:57 AM

Hi, 

I was developing using kendo UI TreeList, however I found an issue when I drop a row from 1 parent to another, the source was not reparenting to the correct parent. Instead if was set to wrong position (as for my case it become a parent itself).

Step to reproduce:
Open this url https://dojo.telerik.com/UCUXaloN

Drag "Sprint planning (2012-2728)" and drop it to "Kick off" as per image below
After the drop the e.position should be "over" and I expect the row will appear inside "Kick Off" node and not as a parent itself. In the drop event after the "over" I will have my own logic to perform certain task.

Help is needed as I try with different and still not able to position it correctly. 

Kok Ho
Top achievements
Rank 1
commented on 30 Jan 2023, 12:58 AM | edited

Hi...after some checking by comparing the existing demo code, found out issues was due to using GUID as parent value. Tested when change the parent into number (eg: 123) then it work fine. working demo (https://dojo.telerik.com/UCUXaloN/4). Is there any workaround as I believe by using number is not a good choice.
Kok Ho
Top achievements
Rank 1
commented on 31 Jan 2023, 03:01 AM | edited

hi anyone, in treelist is there a way when i use drop event, i wanted it to always be as the first element. Existing behavior is that from parent B i drop over to parent A it will appear as first node. But when I drop over it back to Parent B it will appear as per previous state (which is not I want. I want it as always be the first)
Neli
Telerik team
commented on 31 Jan 2023, 01:18 PM

Hi Kok Ho,

Regarding the issue with id being a string I would suggest you to take a look at the following issue logged in our GitHub repository:

- https://github.com/telerik/kendo-ui-core/issues/3142

Regarding the second issue for dropping a node as a first element, could you please elaborate a little bit more on the desired result? I have tested in the Dojo provided in your last reply and the nodes are ordered based on the position where a node is dropped. For example, if I drop a node right below the parent item and above the first child-node the dropped node will be rendered as first child. Could you please describe a little bit more the behavior you need to achieve.

Looking forward to your reply. 

Regards,

Neli

Kok Ho
Top achievements
Rank 1
commented on 02 Feb 2023, 03:59 AM | edited

Hi Neli,

As for first issues, thanks for the link and I have change it accordingly by using number as mapping instead of string / guid and yes it work. May I know if there is any intention that it will be use to support more type?

And as for second issues, kindly use this code https://dojo.telerik.com/UCUXaloN/6, let's say that I would like to drag node "Grooming 2012-28" and drop it to another parent (e.position == "over") which is "Kick Off", after the drop, the node "Grooming 2012-28" it will always appear as last child node to the parent. Same goes if I drag and drop the same node "Grooming 2012-28" back to it original parent (in this case is "Sprint 2012-2728") it will still appear as the position before I drag

I have tested that in existing behavior it seem like has some cache on the old position of the node where if I drop it back to old parent it somehow get to the old position (which I wish to overwrite this behavior).

Therefore, in TreeList, is there a way that can I define whenever I drop a certain node, I would like it to be at a certain position (in my scenario always the first node does not matter it parent has child o sub child).

Example that whenever I drag and drop the node "Grooming 2012-28" to any other parent "Kick Off" or "Capacity planning", it would append or appear as the first child node. Perhaps something that look like this https://docs.devexpress.com/WindowsForms/DevExpress.XtraTreeList.TreeList.SetNodeIndex(DevExpress.XtraTreeList.Nodes.TreeListNode-System.Int32).

Can use the code snippet to provide any suggestion code if any

Regards

Neli
Telerik team
commented on 06 Feb 2023, 12:16 PM

Hi,

Regarding the issue in github - the issue will be reevaluated and depending on the result after that, we will consider if more types will be supported. Thus, currently, I could suggest to follow the item in Github. 

Regarding changing the order of the dropped items I am afraid that currently such customization is not possible and changing the default order of the items when dragging and dropping is not recommended.

In case you have any additional questions on the matter, please let me know.

Regards,

Neli

Kok Ho
Top achievements
Rank 1
commented on 07 Feb 2023, 09:37 AM

Hi, 

Can we set the default order to always the first one when dropping over to an element? 

Neli
Telerik team
commented on 10 Feb 2023, 07:51 AM

Hi Kok Ho,

Currently, the ListView does not provide a configuration option or method that will allow you to set the dropped item to be in the first place by default. Thus, I am afraid that for the item to be dropped at the first position it should be dropped when the 'insert' drag hint is displayed:

If it is suitable for your scenario, you could disable the dropping of items, when the position is 'over'.

Regards,

Neli

Kok Ho
Top achievements
Rank 1
commented on 20 Feb 2023, 09:45 AM

Hi Neli,

 

Thanks for the info

No answers yet. Maybe you can help?

Tags
Drag and Drop TreeList
Asked by
Kok Ho
Top achievements
Rank 1
Share this question
or