javascript - How to limit NestedSortables sublevels? -
i use http://mootools.net/forge/p/nestedsortables sort list of li elements, can sort them unlimited sublevels. need limit 1 sublevel.
https://jsfiddle.net/dq3xqvu9/
new nestedsortables('menu', { onstart: function(el) { }, oncomplete: function(el) { } });
good - want able move them 1 sublevel:
- list item
- list item
- list item
- list item
not - default nestedsortables allows move items unlimited sublevels like:
- list item
- list item
- list item
- list item
- list item
- list item
i added these 3 restrictions nestedsortables class:
abort += (this.getdepth(dest, (move == 'inside')) > 1); abort += ((move == 'inside') && (el.getfirst('ul') != null)); abort += ((move != 'inside') && (el.getfirst('ul') != null) && (this.getdepth(dest, (move == 'inside')) > 0));
complete code on updated jsfiddle.
this modification limits number of sub-levels 1.
Comments
Post a Comment