EasyUI Forum
September 14, 2025, 04:07:38 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: draggable-droppable - onBeforeDrop()  (Read 6112 times)
devnull
Sr. Member
****
Posts: 431


View Profile
« on: July 01, 2015, 08:17:01 PM »

Hi;

I am using draggable and droppable with a PROXY.

I need to check onBeforeDrop() whether to allow the drop or cancel it, how can I do this ?

Thanks
« Last Edit: July 01, 2015, 08:59:33 PM by devnull » Logged

-- Licensed User --
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: July 02, 2015, 03:49:34 AM »

Just use the 'onDrop' event, if allowed, do your really dropping action. Or use the 'onDragEnter' event, if not allowed, call 'disable' method to disable the dropping on the target area.
Code:
$('#dd').droppable({
    onDragEnter: function(e, source){
        if ($(source).text() == 'Apple'){
            $(this).droppable('disable');
        }
    },
    onDrop: function(e, source){
        if (...){
            $(this).html($(source).html() + ' dropped');           
        }
    }
})
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!