TableDnD icon indicating copy to clipboard operation
TableDnD copied to clipboard

onDragStart passes TD element in the 'row' parameter when dragHandle is set on a TD

Open pkokorev opened this issue 11 years ago • 1 comments

When the dragHandle is set to a TD element, it becomes the one that is getting passed in the function(table, row) callback. Not sure that this behavior is wanted. I would prefer getting the TR element as it is easier to find it afterwards inside the table.tBodies[0].rows collection.

pkokorev avatar Sep 30 '13 14:09 pkokorev

The signature for the function is actually function(table, target) and not function(table, row). Since the drag handler is the target of the operation I think this is what would be expected. You stand to loose the particular element if we make any efforts to widen the scope. While this might be exactly what you are looking for in this scenario it may not always be true.

Finding the row however is easy, because the specific element will only ever have one parent that is a row but might have several siblings of the same kind all registered as dragHandles perhaps. You should be able to find the row as follows:


$row = $(target).parents('tr');

Give it a try and let us know...

nickl- avatar Sep 30 '13 16:09 nickl-