[Django]-How to save django drag and drop connected list sortable

0👍

jQueryUI has a widget called a sortable which is just a list of sortable dom elements. It allows you to drag the items around and resort them in a list. Options are passed in an object that you give to the sortable.

Allows the draggable to be dropped onto the specified sortables. If this option is used, a draggable can be dropped onto a sortable list and then becomes part of it.Requires the jQuery UI Sortable plugin to be included.

EXAMPLE:

Initialize the draggable with the connectToSortable option specified:

$( ".selector" ).draggable({
  connectToSortable: "#my-sortable"
});

Get or set the connectToSortable option, after initialization:

// Getter
var connectToSortable = $( ".selector" ).draggable( "option", "connectToSortable" );

// Setter
$( ".selector" ).draggable( "option", "connectToSortable", "#my-sortable" );

jQueryUI also allows you to connect sortables to each other which creates the potential for some interesting user interfaces.

$('#my-list').sortable({
  connectWith: '#my-other-list'
});

Leave a comment