Fork me on GitHub

Ractive.js sortable decorator plugin

download: Ractive-decorators-sortable.js more plugins at ractivejs.org/plugins

This plugin adds a sortable decorator to Ractive, which enables elements that correspond to array members to be re-ordered using the HTML5 drag and drop API. Doing so will update the order of the array.

When the user drags the source element over a target element, the target element will have a class name added to it. This allows you to render the target differently (e.g. hide the text, add a dashed border, whatever). By default this class name is 'droptarget'.

You can configure the class name with the following:

Ractive.decorators.sortable.targetClass = 'aDifferentClassName';