Sortable icon indicating copy to clipboard operation
Sortable copied to clipboard

Added ID-Based Duplicate Protection for Cloning

Open Memocana opened this issue 7 years ago • 6 comments

It's an old closed issue that's been never resolved but I made a solution for #708. I added a new option, allowDuplicates, that is true by default and it preserves the default behaviour of the code. If this tag is set to false, then it checks if there is a conflicting ID in the potential new parent. If there is a such ID, it basically behaves like put = false for that specific grouping.

Memocana avatar May 30 '18 04:05 Memocana

extremely useful!

rsmike avatar Jul 27 '18 12:07 rsmike

Please give a JSBin demonstration of what this feature does

owen-m1 avatar Jan 07 '19 17:01 owen-m1

This is an extremely useful feature. Any idea when this feature will be available in the main CDN link?

ikarthikng avatar Mar 22 '19 14:03 ikarthikng

I could also really use this feature.

t-leftkind avatar Jan 16 '20 19:01 t-leftkind

@Memocana and anyone else.

It looks like there is some demand for this feature. Would you be kind enough to produce an example for us? Thank you in advance.

You can create one using one of these templates.

  • Javascript: https://codesandbox.io/s/sortablejs-javascript-jy3tl?file=/src/index.js
  • Typescript: https://codesandbox.io/s/sortablejs-typescript-6it9n?file=/src/index.ts

waynevanson avatar Apr 13 '20 13:04 waynevanson

if it can help, using jquery

group: { name:'myGRP', put:function(to,from,item){ // console.log("FROM:"+$(from.el).attr('id')) // console.log("ITEM:"+$(item).attr('id')) // console.log("TO:"+$(to.el).attr('id')) if($(to.el).find("#"+$(item).attr('id')).length>0) return false; else return true; }, },

ledahu avatar Feb 13 '21 09:02 ledahu