Sort plugin: Return complete reordered list and not reordered item #4190
mynona
started this conversation in
3. Feature Ideas
Replies: 1 comment 1 reply
-
This is how I managed to do it: <div
x-sort
x-sort:config="{
animation: 100,
store: {
set: function (sortable) {
let items = sortable.toArray().map((value, index) => {
return {
order: index + 1,
value: value,
};
});
$wire.updateItemOrder(items);
},
}
}"
>
<div
x-sort:item
data-id="1"
>
Item 1
</div>
<div
x-sort:item
data-id="2"
>
Item 2
</div>
</div> Where |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
It would be fantastic if the x-sort handler not only returns the item that was changed but the full reordered list.
Use case: you want to persist the sort order and therefore persist the order id of each element in the list.
Beta Was this translation helpful? Give feedback.
All reactions