Comments (3)
Well i have actually implemented some kind of functionality you might find useful for this or other use cases
note that 'acceptDrop' function is being performed before a drop is being processed
the function code is:
function acceptDrop(container, item) { if (item.contains(container)) { return false; } if (container.classList.contains("lmdd-dispatcher")) { return false; } if (scope.lmddOptions.matchObject) { var cType = container.dataset.containerType || false; var iType = item.dataset.itemType || false; return ((cType) ? ((iType) ? scope.lmddOptions.matchObject [cType][iType] : scope.lmddOptions.matchObject[cType]["default"]) : scope.lmddOptions.matchObject["default"]); } return true; }
you will have to turn this functionality on in your options object:
lmdd.set(document.getElementById('basic-example'), { containerClass: 'container', draggableItemClass: 'item', matchObject:{ parentContainer:{ parentContainer: false } }
now the following path (lmddOptions.matchObject.parentContainer.parentContainer) will return false
and you just have to add the proper markup to your html
<div class="parent-container"></div>
for the parent containers
from lean-mean-drag-and-drop.
Grazi, Supraniti.
from lean-mean-drag-and-drop.
@supraniti Thanks for such a wonderful library. I am using this library in my project and have the requirement that two parent containers can't be dropped in each other. I have referred the solution recommended by you in the above comments but couldn't make it work. What is the container and item acceptDrop
function is accepting and to which event you are passing that function?
I have created demo here https://stackblitz.com/edit/react-nuuaqw
Let me know if I am doing it in right way or not?
Thanks!
from lean-mean-drag-and-drop.
Related Issues (17)
- How does this compare to other libraries? HOT 9
- What should we do if we use input element in container? HOT 1
- Drag and drop within positioned parent. HOT 1
- have error in webpack HOT 1
- add npm module
- React compatibility HOT 2
- Alter / remove ghost animation ? HOT 8
- Library doesn't work in Internet Explorer
- question
- Document classes HOT 1
- Feature request: customisable classes
- Reordering elements is too precise HOT 4
- Feature request: ability to tell when an item is over another container HOT 2
- Feature request: ability to disable reordering / moving of original element HOT 3
- First demo example not working with touch in a few browsers HOT 3
- Auto-scroll only cares about window/body scroll HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lean-mean-drag-and-drop.