Submit droped items (in order)
Closed this issue ยท 3 comments
WL1981 commented
Hello,
How to store/submit droped items (in order)?
DRAG FROM:
<x-laravel-blade-sortable::sortable group="orders">
@foreach($orders as $order)
<x-laravel-blade-sortable::sortable-item as="div" sort-key="{{ $order->id }}" class="bg-theme-gray-500 my-1 px-5 py-5 text-white">{{ $order->id }}</x-laravel-blade-sortable::sortable-item>
@endforeach
</x-laravel-blade-sortable::sortable>
DROPED IN:
<form method="POST" action="{{ route('selected_orders.update', $workday->id) }}" class="py-6 px-10">
@csrf
@method('PATCH')
<x-laravel-blade-sortable::sortable group="orders" name="sort_order">
<!--- DROP ZONE -->
</x-laravel-blade-sortable::sortable>
<button type="submit">Submit</button>
</form>
WL1981 commented
Fixed by adding a hidden input in the main loop. Inputs are not created automatically after a drop in the drop-zone
<input name="selection[]" type="hidden" value="{{$order->id}}">
asantibanez commented
Hi @WL1981
I'll check this one. It makes sense to be able to submit both droppable containers. ๐
asantibanez commented
Hey @WL1981
Check out v1.1.0.
Just add a name
prop to each <x-laravel-blade-sortable::sortable>
and you get those hidden inputs with the order ๐