Skip to content
Discussion options

You must be logged in to vote

🧩 Alpine.js Drag & Drop in Livewire — Fixing group not giving column key
After two full days of debugging, here's the working solution to get the actual column key (like "TODO", "IN_PROGRESS", etc.) when sorting tasks with Alpine's x-sort.

✅ Problem:
Alpine’s x-sort:group="tasks" just gives a group name ("tasks") — not the specific column key from your data (e.g., TODO, DONE).
You want to know which column the task was dropped into.

✅ Solution:
Use a data-status="{{ $key }}" on the column container, and grab it via closest('[data-status]') in your Alpine handle() function.

💡 Final Working Code
blade


<!-- Task Cards -->
<div 
   x-data="{
       handle(item, position) {
           const c…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by shaimaHamila
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant