Drag and drop hierarchy tree structure

A new project for one of my clients really needs an element-tree like feature. In short, it’s managing headings, subheadings, subsubheadings etc of a longer document.

So, a user should be able to drag subheadings to be under a different heading and I want an infinite level of nesting.

Does anyone have any neat approaches to this (mainly the infinite nesting part as it’s perfectly feasible to do this manually to like 3 levels of nesting…)? I would do a folder structure where you click on a folder to open it and it displays all the child elements, but I need the entire structure in one view for the sake of UX.

Maybe just have a single DataType which has Nest Depth, Children, Parents & Content fields. Indent the container based on depth, and have different worflows depending on Content/depth etc.
Drag & drop would change Parent field and Depth field.

This is a possible approach which just came off the top of my head, not sure if it would cover all needs.

2 Likes

Oh, having an explicit depth field on the data type is a very smart idea. I’ll do some more exploring there. Then it would be a case of having only one repeating group just with the formatting dynamically specified.

Pretty damn good off the top of your head; would love to see ideas you have after thinking about it longer!
What’s the thought behind Children on the Data Type? I 'd understand a boolean to conditionally show the accordion icon, but is there any need to link actual children?

@georgecollier based on your example (children not alphabetically sorted), you prob also need a sorting value as well although you can bake that into the Nest Dept if weight is a concern.

As a rule of thumb, i always try to avoid a setup which generates the need to run a search on every row of a repeating group or every item of a list; nested repeating groups can be bad, but nested searches are even worse.

Maintaining an explicit list of Children avoids having to use a search to fetch the children.

I know some people avoid Bubble lists at all costs, however i personally see a benefit in them. I believe lists are great if you can make sure that that the list will not exceed 50 (not a hard cap ofc) items and, more importantly, the list will not be modified by multiple users concurrently (as that leads to race conditions nightmares).
^This applies only if you get comfortable with List Shifter and ideally some custom Javascript in order to easily manipulate the order of the bubble lists, because doing that natively with bubble is a nightmare.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.