优化表格行拖拽事件处理

pull/300/head
Ricky 2021-06-18 11:37:41 +08:00
parent 47075cb6f5
commit f63590c116
1 changed files with 10 additions and 5 deletions

View File

@ -152,11 +152,16 @@ jQuery.tableDnD = {
config.dragHandle
// We only need to add the event to the specified cells
&& $(config.dragHandle, table).each(function() {
// The cell is bound to "this"
$(this).bind(startEvent, function(e) {
$.tableDnD.initialiseDrag($(this).parents('tr')[0], table, this, e, config);
return false;
});
if (! $(this).hasClass("nodrag")) {
// The cell is bound to "this"
$(this).bind(startEvent, function(e) {
if (e.target.tagName === "TD" && event.target.className !== "nodrag") {
$.tableDnD.initialiseDrag($(this).parents('tr')[0], table, this, e, config);
return false;
}
return true;
});
}
})
// For backwards compatibility, we add the event to the whole row
// get all the rows as a wrapped set