-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support nested list (drag item from parent list into nested child list) #1001
Comments
This is something I've had to look at too. Instead of having nested droppables/lists you can instead have one droppable with a 'flat' list of all of your draggables and handle their tree/structure separately. This is what I saw @atlaskit/tree doing and have partially built my own implementation. It makes calculating the new position and parent a bit harder (I haven't done it yet 😅) , but in the end it might give some advantages. Virtualization/Windowing looks easier with a flat DOM tree. |
Thanks @markdon!! Yes, that is now @atlaskit/tree works. It is technically a flat structure |
It could be nice to create a general guide for how to achieve this |
If somebody wants to go on a journey and document it - it would be great to add as a guide to this project |
Thanks for the fast reply!! @markdon @alexreardon. Going to try the tree structure and see what I can find |
Hello there! As it seems to me, within the current functionality, it is possible to keep track where (parent or nested list) is current item is being dropped. But on the way to this solution, I faced a number of problems with the animation of moving items from a nested list to the parent. To reproduce the current situation with an example, it is necessary to remove the type attribute in stories/src/vertical-nested/quote-list.jsx:56 (line number) or make it static (for example, 'list'). <Droppable droppableId={list.id} /* type={list.id} */ key={list.id}> This is necessary for the droppable zones to be of the same type (if I don’t confuse anything, then this is a requirement for moving elements (draggable) between the droppable zones). If everything described above is ideologically correct, then I face the following problems. This is not all of them, but the most "visually incorrect".
2.1. Dropout of elements from a nested list when trying to re-sort a nested list within a parent. 2.2. Incorrect behavior of elements under a nested list. With a small movement of the cursor with a nested list, you can see the situation when the elements of the parent list jump by a group or one by one at a time. 3. Sometimes it is difficult to insert an item between a nested list and a parent item.Also, in the process of developing the first prototype, I thought about rerendering an element when it is in state isOnDragging, but faced the fact that this is not possible. Right now these are the main problems I have encountered. Thx for your lib and sorry for my English) |
http://www.bootcss.com/p/layoutit/ @alexreardon , dnd can not do something like this ? |
Can anyone provide source or at least working example of tree drag and drop with react-beautiful-dnd and @atlaskit/tree? |
There's the atlaskit example here. @atlaskit/tree can't drag between trees, but it doesn't require a huge amount of changes to make it happen. I came up with something that suits my use shown here. |
I'm not sure if this has been pointed out before, but this seems to be a valid use-case for nested connected droppables (vertical > horizontal) :
I'm sure this is rather complex to implement (plus it's not in the roadmap). Anyway, just leaving this here. Thanks for all your work @alexreardon :). |
I was trying to implement these features during a few days, But I couldn't catch up using @atlaskit/tree and react-beautiful-dnd together. But I found a proper project today. For anyone like me I suggest to use this project: https://github.com/frontend-collective/react-sortable-tree. It is able to drag-and-drop over parent-child, and support copy behaviors. |
unfortunately it does not support touch devices properly |
@alexreardon can I ask what the underlying limitation is that prevents dragging from a nested list to an outer list and vice-versa? For our use case it's a requirement (we can't flatten our tree structure due to some other limitations). Most people probably don't need this feature, so we'd be fine forking the library. It would be super helpful if you could point us towards what the cause is so we have a place to start! Update What I know so far from playing around with the code:
So, in summary, it looks like the solution would (at least partially) be an extra case that needs to be handled in wherever the |
@alexreardon do you plan to fix this issue ? Thanks for your help ! |
Running into the same issue with a recursive data structure of same type of objects, i.e. I also have played around with <Droppable droppableId="0" type="TYPE" ...>
...
<Droppable droppableId="0.0" type="TYPE" ...>
...
</Droppable>
...
<Droppable droppableId="0.1" type="TYPE" ...>
...
<Draggable draggableId="0.1.0" ...>
...
</Draggable>
...
</Droppable>
...
</Droppable> In the above example In I haven't looked into the code, but I'm making an educated guess that when |
I too desperately need tree support, and the ability to drag items between different levels. I'm seeing that this is still not supported, and I cannot get it to work either. I prefer not to use the Atlaskit tree library, as I'm needing this for various different use cases that don't line up well with that library's opinions. Any update on this? Thanks! |
+1 here. Would really appreciate this. Personally, I think i'm gonna explore sortable-js, and hope that someday some genius will figure this one out. |
so no hope for a nested/tree-like list in react-beautiful-dnd? |
@alexreardon I have similar use cases as well and seems this library is not serving those purposes. I am seriously stuck since more than a week now and hoping the developers should come back at least with an honest response even if otherwise. It seems many people across the globe has such use cases and it is high time that these features should get included in the library. I don't understand why this is not a priority ?? It's been 2 years now and people are asking for it. |
@alexreardon I am also having similar use case. i am using materil ui treeview for nested view and drag and drop is not working for any child treeview item.It's been 2 years now and people are asking for it. |
@Tush2890 Could be another 2 years until this feature is implemented. I suggest to move on. Check this demo I made that features draggable nested lists using another library (react-sortable-js). |
@IlyasArinov I tried your solution and maintained the same hierarchy of DOM nodes as in your demo but after one or two operations, it crashes. After wrapping the parent node with |
@Tush2890 I am not sure what the problem is. All I can say is that I use this library pretty extensively with infinite nested children lists and dragging from another lists, and It works just fine (except It does not rerender on props change, but there is a workaround for that). |
@IlyasArinov does this library support combine feature same as React beautiful dnd provides ? |
@IlyasArinov what i mean by combine is you can drag Item A and put it over item B when drag and over you can get both item A and B and you can perform move or copy functionality. Like how generally works in google drive or any file managers. Where you can drag folder and combine/merge/move to another folder. So is react sortable js provides that kind of combining functionality where i can get both ids ? |
Still nothing here? :( |
You can find here for the nested list dragging child from one parent to another. |
Bug or feature request?
Feature request
Feature request
First of all, amazing work here, kudos to the developers! 👍 👍
I've been using this library to develop a React based UI builder. In my use case, I need the sortable feature to work in a nested element. However I noticed in the readme,
Currently, my work around for this problem is to use the combine feature with nested element so that an element could go inside another element in the same hierarchy and be the child of that element. However, again, I also noticed that the combine feature only works on elements in the same hierarchy (ex: items from a list cannot be combined with items from a nested list and vice versa).
Is there a plan for the nested list so that items could be dragged everywhere regardless of the nested list level? I think this could be beneficial for some use case.
Sorry for my bad english 😄 and thanks again! great work! 👍
The text was updated successfully, but these errors were encountered: