vue-smooth-dnd icon indicating copy to clipboard operation
vue-smooth-dnd copied to clipboard

Is there a convenient way to disable draggables?

Open tstecca opened this issue 4 years ago • 2 comments

Hello Kutlugsahin, et al.

Thank you very much for maintaining the library. Please, is there a convenient way to disable the draggability of items? I'm looking for something like :disabled="yesPleaseDisableMe".

Or possibly:

onDragStart: ()=>{
  // stop the drag.
}

I need this feature to enable dragging by user, based on permissions. I'm currently using :lock-axis="'undefined'" and it does prevent a visible drag action, but it still fires the drag events. I'd like to prevent the drag events all together. If such a feature exists, I haven't seen it in the documentation. I would be happy to create a PR to update the docs, if you like.

Thanks again.

tstecca avatar Jan 02 '20 21:01 tstecca

I was also looking for something like this, would be nice to add a disabled prop to completly disable all drag/drop events.

SherinBloemendaal avatar Jan 05 '20 13:01 SherinBloemendaal

You could specify a drag handle like this:

<Container
  drag-handle-selector=".column .header.movable"
>

And then add or remove the movable class on the column header to enable/disable the dragging. If you never want to enable it, just choose a selector that doesn't exist.

arkuuu avatar Jan 06 '20 13:01 arkuuu