Firstly, I need to send attribute data-name with sorting like this:
/sorting?firstname=0&lastname=1&email=2&country=3
Here is my code:
$("#sortable").sortable({
revert: true,
axis: 'y',
stop: function(event, ui) {
var data = $(this).sortable('toArray', {
attribute: 'data-name'
});
$.ajax({
data: data,
type: 'GET',
url: '/sorting'
});
}
});
$("#draggable").draggable({
connectToSortable: "#sortable",
helper: "clone",
revert: "invalid"
});
How to do that?
And secondly, when i dragged item "Drag empty" to the list, I need to send sorting without them. I need to skip them, for. ex.:
/sorting?firstname=0&lastname=1&email=3&country=4
"Drag empty" is after lastname, then email and country have sorting +1.
Here code sample: