-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Cannot read property 'element' of null when using vue component #647
Comments
Could you create a jsfiddle? |
Vue component are also supported so this linked to your specific example. |
See the following example:
Does this help or do you need more to dig into it? |
Not really. Note that you need to use or list or v-model. |
Sorry, it somehow did not copy the |
@David-Desmaisons I created a jsfiddle including some examples: https://jsfiddle.net/lexixon/nf97erqx/64/ I think I have narrowed down the issue. It occurs whenever there is only one item left within a draggable section and you try to move it and it depends whether it was dynamically added or not (see all examples in jsfiddle). Potentially it has something to do with the nesting but I hope there's a simple explanation what triggers it and how to prevent it. Error:
|
@David-Desmaisons or anyone else any idea what I'm doing wrong or how the issues in the illustrated examples can be explained? |
@alexeigs , I am investigating, this is something that can be correct on vue.draggable side. |
I've had the same issue with this error popping up when reordering nested properties. So for example, the following HTML code:
had to be replaced by:
|
How would that work in my case exactly to transfer the full |
What worked in my case was to move the
I hope this fixes the issue for you as well. |
@Shammah The issue is that this will break the dependency of |
Hmm, I thought I fixed it, but it seems to have only solved a few of my cases. I now get the same error, even when wrapping in a div. My use case to reproduce:
The error does not happen if you start with an already existing list that contains both parent and child nested. |
My colleague found a fix, by simply forcing a Vue rerendering when the amount of children change. This is achievemed by supplying a
Does this work for you as well? I noticed that the Edit:
|
Corrected in version 2.22.0 |
Wrapping a
div
works while wrapping any vue component leads to an error for me. This code is within a nested tree of vue components of which one of the parents also uses draggable (without any issue there).changing the
div
to a vue component likev-card
results in anCannot read property 'element' of null
error when starting to drag.The text was updated successfully, but these errors were encountered: