简体   繁体   English

拖放不适用于jqxtree

[英]Drag and drop not working with jqxtree

I use jqxTree to view my tree. 我使用jqxTree查看我的树。 I want to drag some element and drop on Droppable area. 我想拖动一些元素并放在Droppable区域。

$(".dragItem").draggable({
   revert: "true",
   revertDuration: 0,
   helper: 'clone',
   cancel : 'span',
   refreshPositions: true,
   containment: "parent"
 });

$(".dragItem").css({"position": ""});

$("#log").droppable({
    accept: ".dragItem",
    drop: function(event){
    alert("Dropped");
   }
});

Above Code is given in fiddle. 上面的代码在小提琴中给出。 Can anyone say why the drag and drop is not working Fiddle 谁能说为什么拖放不工作小提琴

Any ideas or suggestions will be helpful. 任何想法或建议都会有所帮助。

Add the dragEnd handler to your tree config like below. 如下所示,将dragEnd处理程序添加到树配置中。 The event argument passed to this handler has plenty of info, I just used some for demo purpose. 传递给此处理程序的event参数具有大量信息,我只是出于演示目的使用了一些信息。 Check fiddle: Fiddle . 检查小提琴: 小提琴

  $('#jqxTree').jqxTree({
       height: '300px',
       ...
       dragEnd: function (event) {
          $('#log').append(event.label);
       }
   });

Seems that alert was mistyped, I've updated the code 似乎警报输入错误,我更新了代码

 drop: function(event){
//alert();
}

http://jsfiddle.net/1fzqtzsz/1/ http://jsfiddle.net/1fzqtzsz/1/

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

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