vue-slicksort icon indicating copy to clipboard operation
vue-slicksort copied to clipboard

Error when one item is disabled

Open lexdubyna opened this issue 5 years ago • 9 comments

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)

lexdubyna avatar Jul 09 '19 10:07 lexdubyna

@Jexordexan I'm getting the same issue

felipearosemena avatar Jul 09 '19 15:07 felipearosemena

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

ghost avatar Aug 11 '19 13:08 ghost

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.

vks-financial-com avatar Sep 06 '19 16:09 vks-financial-com

I'm getting the same issue

uCloudCastle avatar May 19 '21 02:05 uCloudCastle

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

afrazahmmad avatar Jul 06 '21 08:07 afrazahmmad

I also encountered the same problem and hope to solve it

MR-YUZL avatar Dec 02 '21 07:12 MR-YUZL

Same here.

lotestudio avatar Sep 28 '22 08:09 lotestudio

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 avatar Oct 20 '22 16:10 medzhidov

Nevermind, this is a bad solution

medzhidov avatar Oct 20 '22 19:10 medzhidov