API

Methods:

init()

Initialises (enables) the drag and drop functionality by adding all the necessary event listeners and list item attributes. This is required when a list has been rendered with the init option set to false.


destroy()

Disables the drag and drop functionality by removing all the event listeners and setting the draggable attribute to false on the list items.


addNewItem({ item, asLastChild = false }) (since v5.2.0)

Adds a new item to the top or bottom of the list based on the value of asLastChild argument. It returns an object with data property representing the updated list structure.