Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
added : function (leaf, controller, tree) {
if ($.fn.draggable && $.fn.droppable && $.fn.sortable) {
if (leaf.parent.items.length > 1) {
if (leaf.parent.els.children.hasClass('ui-sortable')) {
leaf.parent.els.children.sortable('refresh');
} else {
leaf.parent.els.children.sortable({
axis : 'y',
distance : 5,
containment : '.custom_tree_root',
update : function (event, ui) {
var parent = event.target;
var order = [];
$.each(parent.children, function (index, item) {
// your code is here...
debugger;
});
// your code is here...
debugger;
}
});
}
}
leaf.container.prop('leaf', leaf);
leaf.els.text
.prop('leaf', leaf)
.prop('dropped', null)
.draggable({
addClasses : false,
// revert : true,
distance : 11,
zIndex : 100,
start : function () {
leaf.els.text.prop('dropped', tree);
},
stop : function () {
// your code is here...
debugger;
}
})
.droppable({
addClasses : false,
accept : 'span.tree_leaf_text',
drop : function (event, ui) {
ui.draggable.prop('dropped', leaf);
}
});
}
}
html : {
tree : '<UL>',
leaf : '<LI>',
children : '<UL>',
heading : '<DIV>',
control : '<SPAN>',
status : '<SPAN>',
text : '<SPAN>',
container : '<DIV>'
}
var els = leaf.els = {
control : makeEl('control'),
status : makeEl('status'),
text : makeEl('text', leaf.text),
children : makeEl('children')
};
Custom Tree v2 jQuery plugin