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

Appropriate value for 'v-dragula' binding? #45

Open
shortstuffsushi opened this issue Jun 11, 2018 · 1 comment
Open

Appropriate value for 'v-dragula' binding? #45

shortstuffsushi opened this issue Jun 11, 2018 · 1 comment

Comments

@shortstuffsushi
Copy link

shortstuffsushi commented Jun 11, 2018

Sorry if this is another noob question, but I'm really struggling to piece this together from your example page, docs, and example files.

Same demo

Notice that if you collapse / expand groups after dragging, the components are effectively reset -- the data isn't actually changed. I assume that this is because I don't have the v-dragula binding set correctly. I've tried a number of different values for this including:

  • A unique identifier for each row (almost certain this is wrong)
  • The property on the element being updates (group.items in my example)
  • A global variable for the items being modified

In this case, I would expect the second item there to be the correct one, as the code seems to be doing some splicing logic (which I was keyed into by incorrectly using a string identifier as mentioned). It seems that this library is attempting to manipulate the data array backing it, but perhaps this doesn't work in the case that you have a multi-level component or something?

Hopefully my sample makes sense to demonstrate the issue, if not I can try to make it more clear.

@MrYakobo
Copy link

MrYakobo commented May 26, 2021

Each time you expand the dropdown (with v-if="expanded"), the row component is remounted and thus the state doesn't persist. You want v-show="expanded" instead. Fixed fiddle

Regarding your question on what to supply for v-dragula, it is definitely "the property on the element being updated".

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