EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: suweisi on December 28, 2014, 05:51:34 AM



Title: droppable onDrop Event on ul and li
Post by: suweisi on December 28, 2014, 05:51:34 AM
html
  <ul id="sortable-list">
     <li class="item">test</li>
  </ul>
js
  $("#sortable-list,.list").droppable({
        onDrop : function(e, source) {
      alert(e.target)
        }
  });

The result is the ul#sortable-list onDrop event be fired, shows target element UL, the li .item onDrop event not fired any more, why is this?

I could want if the li.item's onDrop event be fired, and then the ul's onDrop not fired. How to do this?

Thanks.


Title: Re: droppable onDrop Event on ul and li
Post by: stworthy on December 28, 2014, 08:41:56 AM
When start dragging an object, retrieve all the droppable objects and then adjust their position.
Code:
$('#dd').draggable({
onStartDrag: function(){
var droppables = $(this).data('draggable').droppables;
droppables.sort();
}
})
$("#sortable-list,.item").droppable({
onDrop : function(e, source) {
console.log(e.target)
e.stopPropagation();
}
});


Title: Re: droppable onDrop Event on ul and li
Post by: suweisi on December 28, 2014, 11:02:09 PM
This works, but it seems to be strange, why the ul get the onDrop event fired before li onDrop event fired?