camohub / jquery-sortable-lists

jQuery plugin to sorting lists also the tree structures.
MIT License
209 stars 60 forks source link

Max depth #39

Closed andylacko closed 7 years ago

andylacko commented 7 years ago

Hello, is there a possibility to limit nesting level in this list? We only need main list and sublists, any other solution is unwatnted. Can I somehow limit the nesting level?

btw. I really like the lib, it is the best of its kind I found

andylacko commented 7 years ago

I found solution in closed issues...

      isAllowed: function (cEl, hint, target) {
        console.log(hint.parentsUntil('#categoryList','ul').length);
        if ((hint.parentsUntil('#categoryList','ul').length > 1)) {
          hint.css('background-color', '#ff9999');
          return false;
        }
        else {
          hint.css('background-color', '#ddd');
          return true;
        }
      }
camohub commented 7 years ago

Ok so I can close it.