livewire-sortablejs icon indicating copy to clipboard operation
livewire-sortablejs copied to clipboard

Multiple groups with draggable items : drag all group instead of items

Open invaders-xx opened this issue 4 years ago • 3 comments

Dear all,

Many thanks for this great and very useful package.

I have 2 questions:

  1. Is it possible to implement dragging of group of items ?
  2. When moving an item from one group to another, how to handle the previous location of this item within the structure ?

Many thanks in advance for you feedback,

BR David

invaders-xx avatar Nov 30 '21 15:11 invaders-xx

Is it possible to implement dragging of group of items ?

Yes, it is possible to do this, but it was not documented in the readme file yet. I updated the documentation, you can find it here.

When moving an item from one group to another, how to handle the previous location of this item within the structure ?

What do you mean by this? Do you have an example?

gdebrauwer avatar Feb 05 '22 13:02 gdebrauwer

Example: I have a group A with items 1, 2, 3 and a group B with no item I move item 2 from group A to B. How do I know in the result array that 2 is coming from A ? Because on the backend, I have to remove it from A and add it to B.

I hope I made myself clear.

Thanks for help

invaders-xx avatar Feb 08 '22 08:02 invaders-xx

In your blade file, you know which items belongs to which group, so you should be able to know that in your Livewire component class as well before you process the updated order

gdebrauwer avatar Feb 13 '22 14:02 gdebrauwer

Duplicate of https://github.com/nextapps-be/livewire-sortablejs/issues/5

gdebrauwer avatar Oct 19 '23 13:10 gdebrauwer