Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: Draggable - Get Parent Container on Drop

gshell free asked 4 years ago


I'm reviewing the documentation on the draggable plugin and I do not see anything about getting any information on the element being dragged or the parent container the element is in. What I'm looking for is something like having two divs and multiple cards in each div. When I drag a card onto a div, I need the card's ID and the ID of the div I dropped the card onto so I can perform actions in my javascript code. Is there any way to get this information with the draggable plugin?


Marcin Luczak staff commented 4 years ago

Hi gshell,

About draggable elements you would achieve that functionality with listening to one of the drag element events, such as start.mdb.draggable or end.mdb.draggable and getting event target element. Please see snippet below: https://mdbootstrap.com/snippets/standard/marcin-luczak/2672236

You can also check our events tab for Drag and drop component: https://mdbootstrap.com/docs/standard/plugins/drag-and-drop/#api-section-events

The functionality of moving elements between containers is reserved for Sortable element inside Drag and drop component. Normally you would be able to listen to Sortable elements events the same as in Draggable elements but unfortunately, we've found an issue inside this component and it's impossible for that moment. We are working to implement a fix as soon as possible.

Best regards, Marcin



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Opened

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: 2.0.0
  • Device: Windows PC
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No