Constructors

  • Sortable's main constructor.

    Parameters

    • element: HTMLElement

      Any variety of HTMLElement.

    • options: sortablejs.Options

      Sortable options object.

    Returns sortablejs

Properties

el: HTMLElement
active: null | sortablejs
clone: null | HTMLElement

The clone element.

dragged: null | HTMLElement

The element being dragged.

ghost: null | HTMLElement

The ghost element.

utils: Utils
version: string

Get the Sortable version

Methods

  • For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.

    Parameters

    • element: HTMLElement

      an HTMLElement or selector string.

    • Optionalselector: string

      default: options.draggable

    Returns null | HTMLElement

  • Removes the sortable functionality completely.

    Returns void

  • Saving and restoring of the sort.

    Returns void

  • Sorts the elements according to the array.

    Parameters

    • order: readonly string[]

      an array of strings to sort.

    Returns void

  • Serializes the sortable's item data-id's (dataIdAttr option) into an array of string.

    Returns string[]

  • Creation of new instances.

    Parameters

    • element: HTMLElement

      Any variety of HTMLElement.

    • Optionaloptions: sortablejs.Options

      Sortable options object.

    Returns sortablejs

  • Get the Sortable instance on an element.

    Parameters

    • element: HTMLElement

    Returns undefined | sortablejs

  • Mounts a plugin to Sortable

    Parameters

    • Rest...sortablePlugins: SortablePlugin[]

    Returns void

    Sortable.mount(new MultiDrag(), new AutoScroll())