nestable cannot drag to an empty list

Question:

The page I am developing requires that there be two lists, one of which to add items to and then order those items. I am using Jquery plugin called nestable where you can drag and drop list items. it works fine when there are items prepopulated in the list, but when i make an empty list i cannot drag items onto it. I have tried using the dd-empty class everywhere (divs in different locations the ol class, the li class) and nothing seems to work completely. The closest thing that works is setting the ol class to dd-empty. it creates an empty "slot" which i can drag one item to, however it does not allow me to drag anymore items or drag that item back to the original list.

Answer:

Seems that there is no condition that sets "dd-empty" container, then I added such few lines:

if (!model.length) {
  $('<div class="dd-empty"></div>').appendTo(root);
  return root;
}

after
var root = $('<div class="dd"></div>');
in buildNestableHtml function, and now empty container appears and everything works fine.

angular-nestable.js

猜你喜欢

转载自my.oschina.net/u/2391658/blog/2962506