大家好。我用过这个插件https://github.com/ilikenwf/nestedSortable。
我是克隆项目,添加到列表,但我无法移动新项目。如何刷新插件或smth。我需要移动所有列表。它是我的代码。
var ns = $('ol.sortable').nestedSortable ({
forcePlaceholderSize: true,
handle: 'div',
helper: 'clone',
items: 'li',
opacity: .6,
placeholder: 'placeholder',
revert: 250,
tabSize: 25,
tolerance: 'pointer',
toleranceElement: '> div',
maxLevels: 3,
isTree: true,
expandOnHover: 700,
startCollapsed: false,
change: function(){
console.log('Relocated item');
}
});
$("#add-next-block").clone()
.removeAttr('id')
.attr('id', 'group-' +id)
.appendTo('#group-in-category-' + id);
ns.nestedSortable('refresh');
<ol class="sortable">
<li><div>Some content</div></li>
<li>
<div>Some content</div>
<ol>
<li><div>Some sub-item content</div></li>
<li><div>Some sub-item content</div></li>
</ol>
</li>
<li><div>THIS IS CREATED BLOCK, BUT I CAN`T MOVE IT</div></li>