Nested Sort Events

At the moment, there is only one event which fires after dropping an item. You can hook into this event by assigning a callback function to the actions.onDrop property of the Config object like the example below:

new NestedSort({
  data: [
    { id: 1, text: "Item 1" },
    { id: 2, text: "Item 2" },
    { id: 3, text: "Item 3" }
  ],
  actions: {
    onDrop: function(data) {
      // the "data" argument is the new list structure (after dropping the item) object
    }
  },
  el: '#nested-sort-wrap',
  listClassNames: ['nested-sort']
})

As an example, if you drag the "Item 2" and drop it inside the "Item 1" the data argument passed to your callback would be:

[
  { id: "1", parent: undefined },
  { id: "2", parent: "1" },
  { id: "3", parent: undefined }
]