Opened 8 years ago

Closed 8 years ago

#7387 closed bug (notabug)

TableDnD does not respect nodrag / nodrop when resorting dropped items

Reported by: tamarmot Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.draggable Version: 1.8.12
Keywords: Cc:
Blocked by: Blocking:

Description

Situation: I have a table with n rows, some of which are "locked". Rows which are locked should not be draggable nor should they allow drops. I have set class="nodrag nodrop" and added onAllowDrop: function(draggee, droppee){

return (!isLocked(droppee.id));

},

to tableDnD().

If my locked items are something like this:

1 a 2 b 3 c LOCKED 4 d 5 e

when I go to drag for example row 4 to row 2, the "shuffling down" action will change the contents of row 3 so I will get: 1 a 2 d 3 b LOCKED 4 c 5 e

so as you see row 3 is changed via the "shuffling down", which seems to be caused from the mousemove method, by the parentNode.insertBefore method: if (movingDown && jQuery.tableDnD.dragObject != currentRow) {

jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow.nextSibling);

} else if (! movingDown && jQuery.tableDnD.dragObject != currentRow) {

jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow);

}

This does not take into account the nodrag/nodrop "locked" state of various table rows.

Change History (2)

comment:1 Changed 8 years ago by tamarmot

to clarify: If my locked items are something like this:
1 a
2 b
3 c LOCKED
4 d
5 e

when I go to drag for example row 4 to row 2, the "shuffling down" action will change the contents of row 3 so I will get:
1 a
2 d
3 b LOCKED
4 c
5 e

Note how 3 has changed from c to b even though it is locked.

comment:2 Changed 8 years ago by Scott González

Resolution: invalid
Status: newclosed

tableDnD is not part of jQuery UI.

Note: See TracTickets for help on using tickets.