Challenge about reordering lists using drag and drop

Ok so here is the challenge. I bought the trello tutorial which is very cool by the way. I am using the drag and drop and am trying to reorder a list based on where the droppable element is dropped. What formula or method can I use to change only the block being moved without having to make changes to other blocks, which slows everything down.

For example I have a list like so

A1
A2
A3
B1
B2
B3

If I want to move B2 under A2 what workflow or formula can I use without making changes to the entire list?

Right now I have it set where it goes +.001 to the current number of the destination block. So when I drag B2 to A2 it adds .001 to B2 to make it fall under A2. But when I drag B3 under A2 it breaks it since both B2 and B3 have the same order value of A2+.001 . I have spent a day contemplating this and I am sure the answer is simple but it eludes me.

To change everything on the list would slow down the drag and drop so I don’t like this idea. I want an elegant solution the makes only a change to the block being moved.

Any thoughts would be greatly appreciated. Virtual keg for the most elegant solution:)

1 Like

I’ve seen this brought up a few times, and I’ve tried to figure it out as well. There are some solutions, but I haven’t seen anything that is all that clean yet. Will be following this thread…

1 Like

Yeah I am wondering if there can be a formula set up at the field level that changes the update value after every update. Then when something is dragged it uses a slightly different formula. Tried a few ways with this but none have worked so far. The answer is out there. We just have to wait for it:)

Brad, actually we have that solution already in the trello clone. We have a sorting field for every task. By default it’s 1,2,3 etc.
But when the task is moved between other tasks, let’s say which have sorting 2 and 3, then we simply sorting of 2.5 to the task which is moved (we take the average of the two), and this can work with infinitely small number as many times as you need the task to move. For example if it’s between 2 and 2.5 then the moved task will have sorting 2.25 so on.
Does it make sense?

Thanks,
Levon.

Founder at Bubblewits - Bubble Certified Partner

http://bubblestore.io – a place to buy Bubble templates for landing pages, e-commerce, workflows, APIs etc.
http://iambubble.com - one page Bubble demo
http://builtonbubble.com - Collection of apps built on Bubble

4 Likes

That is elegant!!! The formula in your trello app does does not seem to do this exactly or I am missing something. Awesome suggestion though. I just have to figure out how to write the expression exactly.

In fact that’s exactly how it’s already configured in the Trello app, that’s how reordering of tasks works based on where you drop them :slight_smile: it may look a bit confusing at first but if you dig deeper you’ll see the idea :slight_smile:

Thanks,
Levon.

Founder at Bubblewits - Bubble Certified Partner

http://bubblestore.io – a place to buy Bubble templates for landing pages, e-commerce, workflows, APIs etc.
http://iambubble.com - one page Bubble demo
http://builtonbubble.com - Collection of apps built on Bubble