EasyUI Forum
September 14, 2025, 07:17:09 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: droppable onDrop Event on ul and li  (Read 7974 times)
suweisi
Newbie
*
Posts: 2


View Profile Email
« 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.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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();
}
});
Logged
suweisi
Newbie
*
Posts: 2


View Profile Email
« Reply #2 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?
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!