Sortable is not defined


Topic: Sortable is not defined

Espen Rønning pro premium priority asked 4 years ago

Expected behavior const instanceSortable = Sortable.getInstance(sortableElement); This should get the sortable instance of the element sortableElement

Actual behavior Javascript error: Sortable is not defined

Resources (screenshots, code snippets etc.) https://mdbootstrap.com/snippets/standard/ererling-sande-no/3040842#js-tab-view

The snippet is built from Drag & Drop API documentation: https://mdbootstrap.com/docs/standard/plugins/drag-and-drop/#api-section-methods


Michał Duszak staff answered 4 years ago

Now it's correct and working. Sortable element didn't have an ID, and I had to look in the DragAndDrop module to get Sortable

HTML

<div id="sortable" data-mdb-sortable="sortable">

JS

const instanceSortable = DragAndDrop.Sortable.getInstance(sortableElement);

https://mdbootstrap.com/snippets/standard/m-duszak/3047212


Espen Rønning pro premium priority answered 4 years ago

Thanks,

Next question - how to update the list of sortable elements? Nothing happens when you press Add Element (exept for the alert message).


Michał Duszak staff answered 4 years ago

Thank you for your feedback. I see this option is not working properly. I am currently working on locating the problem, and fixing it as fast as we can.


Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 3.5.0
  • Device: PC
  • Browser: Google Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: Yes
Tags