Topic: Drag and drop Sortable table with elements added from JavaScript

Espen Rønning priority asked 2 weeks ago

Expected behavior I should be able to sort elements

Actual behavior Sorting is not working (sorry for the inadequate description, but please take a look at the code snippet and try to sort the elements...)

Resources (screenshots, code snippets etc.)

Grzegorz Bujański staff answered 2 weeks ago

Thanks for reporting. We'll fix it. Before we release a fixed version, you can first add elements to sortable-list and then init Sortable:

// Sortable
const sortableEl = document.getElementById('sortable');
    const newElement = document.createElement('div');
    newElement.textContent = 'New Element '+i; 
const instanceSortable = new DragAndDrop.Sortable(sortableEl);

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: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 7.3.2
  • Device: PC
  • Browser: Chrome
  • OS: Windows 11
  • Provided sample code: No
  • Provided link: Yes