Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to only include 2 groups in the array/only send requests to the lists you're dragging between? #15

Closed
seabasss opened this issue Aug 28, 2022 · 2 comments

Comments

@seabasss
Copy link

seabasss commented Aug 28, 2022

This package is amazing! I like the original one, but this took care of 3-4 glitches that I struggled with using the other package.

There's only one thing that made it trickier for my use case. I have a parent livewire component and then child livewire components each containing lists where you can drag items between the livewire components. With the original package this sent one request to the parent component. With this package it sends multiple requests to the child components.

I moved my reorder method to the child component and rewrote some parts and it's working pretty well, but the one thing I'm having difficulties with is that I only need the reorder array to contain the two lists that I'm dragging items between, and ideally only send requests to those two child components.

Right now I can do a check and see if there are two lists and if there are I know that one will be the one I moved from and the other one the one I'm moving to. With three lists or more, there is no way (that I have found) to know which lists should be updated.

Another way I can think of is if the array contained info about which one you're moving from and which one you're moving to. Just one extra parameter.

One more way would be to have an option to only send to the parent component like the original package and do all updates in one place. You’d need emits to update the children or change wire:key to make it update or something.

Any ideas of how to get around this?

Thank you so much! I'm very happy to have found this package!

@gdebrauwer
Copy link
Contributor

There's only one thing that made it trickier for my use case. I have a parent livewire component and then child livewire components each containing lists where you can drag items between the livewire components. With the original package this sent one request to the parent component. With this package it sends multiple requests to the child components.

In v0.4.0, this has been fixed. The package will now call the method on the Livewire component that has the element with the wire:sortable-group attribute. This is now the same behavior as the livewire/sortable package

@gdebrauwer
Copy link
Contributor

I will close this issue for now. If you still have a problem, please open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants