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

BUG move the sort When there is only one component in the container #167

Closed
shenzhirong opened this issue Jun 21, 2017 · 12 comments
Closed

Comments

@shenzhirong
Copy link

Uncaught TypeError: Cannot read property 'map' of undefined
method:function computeVmIndex(vnodes, element) {
return vnodes.map(elt => elt.elm).indexOf(element)
}

@David-Desmaisons
Copy link
Member

David-Desmaisons commented Jun 21, 2017

jsfidle? scenario?

@shenzhirong
Copy link
Author

BUG Bescription : There are two containers A and B, there is a content in B, no in B, drag the contents from A to B when the mouse button does not release and move in the B container, this will trigger the method :
function computeVmIndex(vnodes, element) {
return vnodes.map(elt => elt.elm).indexOf(element)
}

@David-Desmaisons
Copy link
Member

Hello @shenzhirong , please provide a jsfiddle. Thanks

@shenzhirong
Copy link
Author

shenzhirong commented Jun 22, 2017

example path: https://github.com/David-Desmaisons/draggable-example
The example does not change, just setting the container B with height and width and borders
xxx

@7greenfrog7
Copy link

yes, i found this limitation too in my project. i think that until b lie in the box that has a bigger size than b itselft in a, b can drop in a correctly, or error will be trriggled!!!!

@David-Desmaisons
Copy link
Member

Hello,
I am not able to reproduce: version 2.13.1:

vudraggable

@shenzhirong
Copy link
Author

shenzhirong commented Jun 23, 2017

I use the version is also 2.13.1 。

You need to set the css first :
.list-group {
min-height: 20px;
height: 500px;
width:200px;
border: 1px solid red;
}

Then you only need to drag the contents of container A to container B, dragged into the container B up and down the mouse

@David-Desmaisons
Copy link
Member

David-Desmaisons commented Jun 23, 2017

OK. got it. It is linked to the use of the move prop in this demo application.
So If you don't need onMove, remove it as a quick bypass.
I will provide a fix later.

@shenzhirong
Copy link
Author

thanks . If you fix this bug please tell me

@David-Desmaisons
Copy link
Member

@shenzhirong I will provide a corrected version probably with week-end

@David-Desmaisons
Copy link
Member

@shenzhirong It is fixed in version v2.14.0

@jseger
Copy link

jseger commented Mar 2, 2018

I have a related issue I think. I can drop elements on the draggable container just fine. However, if there is one element in the container when the component loads, for example, one item in the cart, if I try to drag another one, the element gets pushed to the first index. Then as soon as I try to drag either of the two elements, I get a Cannot read property 'element' of null error.

To summarize....

Draggable works as expected unless it is loaded with one item. If there are multiple items, draggable works fine.

If there is one component in the container when the component is loaded, and I remove it, then try to drag a new item onto it, I get the same error. So you can narrow it down to "Draggable acts funny when loaded with one item."

I'll try to create a repo to reproduce soon.

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

4 participants