Added ID-Based Duplicate Protection for Cloning
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.
extremely useful!
Please give a JSBin demonstration of what this feature does
This is an extremely useful feature. Any idea when this feature will be available in the main CDN link?
I could also really use this feature.
@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
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; }, },