nestable cannot drag to an empty list

原创
2018/11/28 17:26
阅读数 161
AI总结

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

 

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
0 评论
0 收藏
0
分享
AI总结
返回顶部
顶部