Topic: drag and drop sortable api

tjwilco free asked 2 years ago

I'm trying to use the API to trigger an action when an item is moved. I'm using the code from your documentation but nothing is happening.

const sortableItem = document.getElementById('sortable-item-1');
sortableItem.addEventListener('move.mdb.sortable', (e) => {

What am I doing wrong?

Aleardo Lodi priority answered 2 years ago

I have the same problem with exit.mdb.sortable but I can't resolve with a similar workaround using onExit. Suggestions?

Mateusz Lazaru staff commented 2 years ago

hi, it seems to work fine:

Michał Duszak staff answered 2 years ago

@Danny we didn't fix this issue. Until it's not fixed, you can create a workaround in the source code - in the sortable.js file there is this EVENT_MOVE constant in Line 41 - you have to change its name, for example:

const EVENT_MOVE = `onMove${EVENT_KEY}`;

then it should work under a different event - onMove.mdb.sortable

  const sortableItems = document.querySelectorAll('.sortable-item');
    sortableItems.forEach(item => {
      item.addEventListener('onMove.mdb.sortable', (e) => {

Michał Duszak staff answered 2 years ago

Hello, thank you for reporting this issue. It's in our TO DO list and will be resolved as soon as it is possible.

Best regards and keep coding,


Danny priority commented 2 years ago

Is this still not fixed? Can't get it working neither.

Please insert min. 20 characters.


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



Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 3.10.2
  • Device: any
  • Browser: any
  • OS: any
  • Provided sample code: No
  • Provided link: No