简体   繁体   English

Sortable.js无法正常工作:列表项不可拖动

[英]Sortable.js is not working: List items are not draggable

I have tried a very simple example with Sortable.js: Two lists: One is currently empty, and will store item copies from the other list (which is static). 我用Sortable.js尝试了一个非常简单的示例:两个列表:一个列表当前为空,并将存储另一个列表中的项目副本(这是静态的)。

I tried defining pull and put values for each list, defining the same group name, but it does not work. 我尝试为每个列表定义拉入和放置值,定义相同的组名,但是它不起作用。 In fact the static elements from the filled list are not draggable at all. 实际上,填充列表中的静态元素根本不可拖动。

I have written the example at JSbin . 我已经在JSbin上编写了示例 Since I am new to JS, I accept all kind of constructive comments. 由于我是JS新手,因此我接受各种建设性意见。

BTW: any way of drawing the bootstrap list borders even when empty? 顺便说一句:有什么办法绘制引导列表边界,即使是空的?

I have edited the jsbin and did the following corrections 我已经编辑了jsbin并进行了以下更正

  • Replaced the sortable.js with 将sortable.js替换为

      <script src="//cdn.jsdelivr.net/sortable/latest/Sortable.min.js"></s‌​cript> 
  • You were accessing the ids with _ (instances_list, main_list) whereas the ids were having an - 您正在使用_ (instances_list,main_list)访问ID,而ID具有-

  • For the appending to work I had to add one item by default to instances-list than keeping it empty 为了使添加工作正常工作,我必须默认将一个项目添加到instances-list不是将其保留为空

JSBin JSBin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM