Optimized ddmanager
Optimized ddmanager
Hello,
I am trying to write an optimized ddmanager for my requirements : I
need to be able to drop stuff in a big table (200 rows by 5 columns)
in IE6. Every cell is a drop target and the default ddmanager is too
slow : a small delay is visible when starting the drag...
As my needs are very specific I am trying to write my ddmanager this
way :
1) iterate on each table row and check y coordinate of drop to check
if draggable was dropped on that row
2) iterate on each cell of the row to find out which cell the
draggable was dropped on
From what I was this speeds up things quite a bit... However I do not
succeed on triggering the drop event properly because I don't know how
to connect to the droppable widget corresponding to the cell
identified... Of course I would like to avoid to iterate in the
droppables array of the ddmanager but maybe there is no other way...
For reference, my so-called optimized ddmanager :
$.ui.ddmanager = {
current: null,
droppables: [],
prepareOffsets: function(t, e) {
},
drop: function(draggable, e) {
var x = e.originalEvent.clientX;
var y = e.originalEvent.clientY;
$('#grid tr').each(function() {
var offset = $(this).offset();
if (y >= offset.top && y < offset.top + this.clientHeight)
{
$(this).children('td.ui-droppable').each(function() {
var offset = $(this).offset();
if (x >= offset.left && x < offset.left +
this.clientWidth)
{
// call drop handler on td : HOW ?
return true;
}
});
}
});
return false;
},
drag: function(draggable, e) {
}
};
Thanks !