Skip to content

Instantly share code, notes, and snippets.

@bsylvain
Created September 29, 2016 19:53
Show Gist options
  • Save bsylvain/d72fd2afd32797d10830e20fce808887 to your computer and use it in GitHub Desktop.
Save bsylvain/d72fd2afd32797d10830e20fce808887 to your computer and use it in GitHub Desktop.
$('.sortable').nestedSortable({
forcePlaceholderSize: true,
handle: 'div',
helper: 'clone',
items: 'li',
opacity: .6,
placeholder: 'placeholder',
revert: 250,
tabSize: 25,
tolerance: 'pointer',
toleranceElement: '> div',
maxLevels: 4,
isTree: true,
expandOnHover: 700,
startCollapsed: false,
relocate: function(data){
data
array = $('ol.sortable').nestedSortable('toArray', {startDepthCount: 0});
$.ajax({
url: "/backend/familles/change_order",
type: "POST",
data: {sort_array: JSON.stringify(array)}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment