EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: rljain on May 17, 2012, 02:46:46 AM



Title: click with draggable
Post by: rljain on May 17, 2012, 02:46:46 AM
hello i m using your plugin easyui for darh and drop
but i m not able to click on element after i applied dragging on them
i applied click event to some controls and also want to dragg them
but only dragging is working not clicking
and if i comment the dragging code click work fine
please help me out urgently what is the issue ?


Title: Re: click with draggable
Post by: rljain on May 22, 2012, 09:29:26 PM
hey any one out there to help me
it's urgent guys please help me out


Title: Re: click with draggable
Post by: stworthy on May 23, 2012, 12:10:08 AM
Please provide some test code to explain more detail about your issue.


Title: Re: click with draggable
Post by: rljain on May 23, 2012, 12:32:38 AM
thanks for your consideration

 $(function () {
            $('.ControlContainer a').dblclick(function () {
                alert('hello');
            });
            $('.ControlContainer a').draggable({
                revert: true,
                proxy: 'clone',
                onStartDrag: function () {
                    $(this).draggable('options').cursor = 'not-allowed';
                    $(this).draggable('proxy').css('z-index', 10);
                },
                onStopDrag: function () {
                    $(this).draggable('options').cursor = 'move';
                }
            });
});


problem is that my double click event which is on top not fire when i apply draggable with that if i comment out draggable code double click work fine i want both to work together please help me out


Title: Re: click with draggable
Post by: stworthy on May 23, 2012, 05:03:42 AM
When start dragging an object, its proxy object will display on top of source object. The dblclick event will become invalid. To solve this issue, hide the proxy object and delay its display. The code looks like this:
Code:
$(function () {
         $('.ControlContainer a').dblclick(function () {
             alert('hello');
         });
         $('.ControlContainer a').draggable({
             revert: true,
             proxy: 'clone',
             onStartDrag: function () {
                 $(this).draggable('options').cursor = 'not-allowed';
                 var proxy = $(this).draggable('proxy').css('z-index', 10);
                 proxy.hide();
                 setTimeout(function(){
                proxy.show();
                 }, 500);
             },
             onDrag: function(){
            $(this).draggable('proxy').show();
             },
             onStopDrag: function () {
                 $(this).draggable('options').cursor = 'move';
             }
         });
});



Title: Re: click with draggable
Post by: rljain on May 23, 2012, 06:53:27 AM
thank you so much
it's work like a charm now
you rock dude.....