TableDnD
TableDnD copied to clipboard
onDragStart passes TD element in the 'row' parameter when dragHandle is set on a TD
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.
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...