Advanced SortableJS Configuration Options for Angular

View code

Explore advanced customization options for Angular drag and drop. This example shows how to configure animation speed, handles, filters, and other SortableJS options to create the perfect user experience.

Disabled Sortable Elements Example

  • Element 1
  • Element 2
  • Element 3
  • Element 4
  • Element 5

and the actual model is

[ "1", "2", "3", "4", "5" ]

Events

Binding to the events is easy. Any even could be attached as a property of Sortablejs. The example below binds to the onUpdate event. Drag the items and track the amount of updates.

Updated 0 times
  • Element 1
  • Element 2
  • Element 3
  • Element 4
  • Element 5
Hint: for the FormArray using onUpdate is kinda overhead because the FormArray.valueChanges provides an event on every change.

Autoscroll with fixed navbar

Normally the scrolling that is performed by Sortablejs is working fine. However with a fixed navbar it may cause problems.

Setting the scrollSensitivity to the proper value will solve the problem. Try it on the long list below

  • Element 1
  • Element 2
  • Element 3
  • Element 4
  • Element 5
  • Element 6
  • Element 7
  • Element 8
  • Element 9
  • Element 10
  • Element 11
  • Element 12
  • Element 13
  • Element 14
  • Element 15
  • Element 16
  • Element 17
  • Element 18
  • Element 19
  • Element 20
  • Element 21
  • Element 22
  • Element 23
  • Element 24
  • Element 25
  • Element 26
  • Element 27
  • Element 28
  • Element 29
  • Element 30