Skip to main content

Search and Top Navigation

#7387 closed bug (notabug)

Opened May 17, 2011 04:04PM UTC

Closed May 17, 2011 04:34PM UTC

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.

Attachments (0)
Change History (2)

Changed May 17, 2011 04:07PM UTC by tamarmot comment:1

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.

Changed May 17, 2011 04:34PM UTC by scottgonzalez comment:2

resolution: → invalid
status: newclosed

tableDnD is not part of jQuery UI.