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

Help Wanted

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

Dear all,

Many thanks for this great package.

I have the this code : <ul class="list-group" wire:sortable="reorderSections" wire:sortable-group="reorderFields"> @foreach($data['structure'] as $i => $section) <li class="list-group-item" wire:sortable.item="{{ $i }}" wire:key="section-{{ $i }}"> {{ __('Section').' : '.$section['name'][app()->getLocale()] ?? __('Undefined') }} <span wire:sortable.handle><i class="fas fa-sort"></i></span> <ul class="list-group p-4" wire:sortable-group.item-group="{{ $i }}"> @foreach($section['fields'] as $j => $field) <li class="list-group-item" wire:sortable-group.item="{{ $j }}" wire:key="item-{{ $j }}"> {{ __('Field').' : '.$field['name'] }} <span wire:sortable-group.handle><i class="fas fa-sort"></i></span> </li> @endforeach </ul> </li> @endforeach </ul>

And when moving a group's item to another group I have the following result in reorderFields function array:2 [[▼]() 0 => array:3 [[▼]() "order" => 1 "value" => "0" "items" => array:2 [[▼]() 0 => array:2 [[▼]() "order" => 1 "value" => "0" ] 1 => array:2 [[▼]() "order" => 2 "value" => "0" ] ] ] 1 => array:3 [[▼]() "order" => 2 "value" => "1" "items" => [] ] ] which is right, but I don't know how to identify the group from where the item is coming from in order to remove it from the global array where all the structure is stored.

Many thanks in advance for your help.

invaders-xx avatar Feb 05 '22 17:02 invaders-xx

my apologies, I lost myself with keys.

invaders-xx avatar Feb 05 '22 18:02 invaders-xx

No in fact I still have this issue. Can you please help me

invaders-xx avatar Feb 06 '22 04:02 invaders-xx

@invaders-xx Hi. Did you figure out how to handle this?

ArtMin96 avatar Feb 18 '22 18:02 ArtMin96

Right now, I don't have any plans to add this. Feel free to create a PR to add this behavior.

gdebrauwer avatar Oct 27 '23 07:10 gdebrauwer