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

How to add item to the list or remove item from the list? #110

Open
theodol59 opened this issue May 10, 2024 · 0 comments
Open

How to add item to the list or remove item from the list? #110

theodol59 opened this issue May 10, 2024 · 0 comments

Comments

@theodol59
Copy link

Good afternoon,

Every item in my list has a remove button. When I press it, I want item to be removed.
Additionally, I have a need to add items to my current rendered Sortable component.

It seems that Sortable component doesn't react to removals or additions. In order for Sortable to update itself with new "list" value, I need to pass unique Vue "key" property to Sortable component. Only then Sortable component re-renders itself... But it has many drawbacks as every item looses its rendering state...

Could you give me an example (based on https://github.com/MaxLeiter/sortablejs-vue3/blob/main/src/examples/WithStore.vue) how to add an item to the fruits list and how to remove a fruit from the list so that other items are not mounted again?

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

1 participant