Vue.draggable: How to fix position (disable sort) of specific element within a drag area/list?

Created on 23 Jul 2018  路  6Comments  路  Source: SortableJS/Vue.Draggable

How can I fix one element within a dragarea so that sorting will not affect that specific element? In the fiddle (from another user), I want all elements to be draggable and sortable, except for element "C". I want that element to have a fixed position while other elements are free to be dragged/dropped.

https://jsfiddle.net/42v38co0/5/

Most helpful comment

I'm facing the same issue. The :move handler only prevents an item from being dragged. It does _not_ fix its position.

See here. The goal is for item F to be fixed. While F cannot be dragged, other items can be dragged below F, so its position in the list is not actually fixed.

Fixing an item to the top or bottom of the list is the typical use case.

All 6 comments

Use move props

I'm facing the same issue. The :move handler only prevents an item from being dragged. It does _not_ fix its position.

See here. The goal is for item F to be fixed. While F cannot be dragged, other items can be dragged below F, so its position in the list is not actually fixed.

Fixing an item to the top or bottom of the list is the typical use case.

@EricTetz did you find a solution?

I need to fix an element inside the list, too.

Same issue here. Any updates?

I have made a codepen that solves the issue of locking an item to the top or bottom of the list: https://codepen.io/naffarn/pen/KKdVRRE

This uses the futureIndex property of the evt.draggedContext as well as the index property to test if the object is movable.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Leadaxe picture Leadaxe  路  3Comments

AnnaStuehlmeyer picture AnnaStuehlmeyer  路  3Comments

karam94 picture karam94  路  3Comments

rootman picture rootman  路  3Comments

Nrqz picture Nrqz  路  3Comments