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

Disable drop after certian item?

Open arthabus opened this issue 5 years ago • 4 comments
trafficstars

Hi, I have a list of draggable items which can be partially and temporarily disabled for any manipulations.

Let's say there is a list of 10 items and first 6 are enabled while the rest 4 are disabled.

Is there a way to prevent user from dropping the "enabled" item to any item among those 4 (basically to any position after index 6 in this case)?

I guess should-accept-drop can be used for that but I can't really see how to apply it for this use case.

Any advice is much appreciated.

arthabus avatar May 22 '20 12:05 arthabus

Add a counter in your component and in onDrop increase the counter. Check if the counter reached the limit in should-accept-drop and return false when needed.

Cmacu avatar Sep 23 '20 03:09 Cmacu

@Cmacu I mean, should-accept-drop seem to evaluate at the beginning of drag and not at the end.

I guess my question is - what is the API that can disable drop for a single item inside a container at the end of drag?

arthabus avatar Sep 29 '20 09:09 arthabus

@Cmacu I mean, should-accept-drop seem to evaluate at the beginning of drag and not at the end.

I guess my question is - what is the API that can disable drop for a single item inside a container at the end of drag?

Have you solved your problem yet

dgf957492430 avatar Aug 24 '21 17:08 dgf957492430

@dgf957492430 nope...

arthabus avatar Sep 13 '21 18:09 arthabus