Jexordexan / vue-slicksort

A set of vue mixins to turn any list into an animated, touch-friendly, sortable list ✌️
http://vue-slicksort.netlify.app
Other
1.48k stars 157 forks source link

Error when one item is disabled #90

Open lexdubyna opened 5 years ago

lexdubyna commented 5 years ago

When one of the items is :disabled and I try to move other items I get this error on sort end:

Uncaught TypeError: Cannot read property 'node' of undefined
    at VueComponent.transitionHelperIntoPlace (vue-slicksort.umd.js?11b0:710)
    at VueComponent.handleSortEnd (vue-slicksort.umd.js?11b0:692)
felipearosemena commented 5 years ago

@Jexordexan I'm getting the same issue

ghost commented 5 years ago

Same problem here, it seems that the error occurs within the transitionHelperIntoPlace function at var indexNode = nodes[this.index].node; Because this.index doesnt take into account the disabled element/s

ie. when dragging the last item in a list of 5, nodes.length = 5 and this.index = 4 after disabling one item, nodes.length = 4 and this.index = 4

vks-financial-com commented 5 years ago

Setting draggedSettlingDuration to 0 will solve the error, but there will be no smooth "return to position" animation. So yea, this is a bug and it would be nice if it gets fixed.

uCloudCastle commented 3 years ago

I'm getting the same issue

afrazahmmad commented 3 years ago

:index should be given from v-for loop. if you give different index value then sorting doesn't work.

MR-YUZL commented 2 years ago

I also encountered the same problem and hope to solve it

lotestudio commented 2 years ago

Same here.

medzhidov commented 2 years ago

I found a solution, you need just change disabling logic, instead of removing nodes just skipping them in animation, works fine: https://github.com/Jexordexan/vue-slicksort/pull/170

medzhidov commented 2 years ago

Nevermind, this is a bad solution