This is a migrated thread and some comments may be shown as answers.

Telerik drag and drop over event subscribes to wrong jQuery event.

3 Answers 34 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Florian
Top achievements
Rank 1
Florian asked on 09 Jan 2012, 03:35 PM
In jQuery the over event gets repeatedly fired when the cursor is over the drop location.

I'm trying to build my on Control based on the Telerik base classes and JavaScript to get the same look and feel but i noticed this, in the grid this is no problem, because the drop location is always somewhere else.

But unfortunately this doesn't work for my scenario i'need a droppable on the same tbody, where i started dragging. Right now i have a jQuery solution, but i really would like to use the telerik version.

This is the line:

telerik.draganddrop.js
63:       $(this.owner).delegate(this.selector, 'mouseenter', $.proxy(this._over, this))

which in my opinion should be:

63:       $(this.owner).delegate(this.selector, 'mousemove', $.proxy(this._over, this)) 

Maybe there is a reason for this, then please let me know.

regards,
Flow

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 10 Jan 2012, 09:48 AM
Hello Flow,

The current implementation is by design - the idea is to know when the user has dragged the draggable object over the droppable area.

In your scenario you can assume that you are already over the droppable zone, so you don't need to use mouseenter at all. However, you can use mouseleave to see whether the user has dragged the object outside the droppable area and alert him, for example.

Another way to go in this case is to instantiate each table row as a separate droppable area and then you will be able to use mouseenter. This is likely to be better performance-wise, as fewer event handlers will be executed.

Kind regards,
Dimo
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Florian
Top achievements
Rank 1
answered on 10 Jan 2012, 01:06 PM
Hello Dimo,
i'm doing exactly what you are describing right now. My problem is, i want to display a drop indicator based on the actual position of the cursor. e.g. when in the top half of a td i want to mark the top as drop location and if in the lower half at the bottom.

In the Grid there is almost the same functionality for grouping when there is more then one group. But this is handled in the drag function of the draggable, but i would like to have drop specific behavior in the droppable instead of the draggble otherwise i need to know all possible drop locations from the draggable.

I solved it for now by applying an additional style to all drop locations and using the mousemove event additionally to the over event, by applying another style when the drop location style is applied, but this is a bit messy and could be simplified.

I don't know the implications on the other telerik controls as well as you are, so i guess for now i have to stick with this.

Thanks,
Flow

PS: Any chance we see the open source release of 2011.3.1306 any time soon(TM) ?
0
Dimo
Telerik team
answered on 10 Jan 2012, 01:13 PM
Hi Flow,

Open source developers are entitled only to major releases of the Telerik MVC Extensions. The 2011.3.1306 release is a service pack. The next major release is scheduled for mid February.

Kind regards,
Dimo
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
General Discussions
Asked by
Florian
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Florian
Top achievements
Rank 1
Share this question
or