Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery-ui sortable: elements dragged behind when using multiple sortables

I have a series of nested sortable elements exhibiting some strange behaviour with z-indexes.

Basically, on some occasions elements are dragged behing the parent containers. It appears only after parent element has been sorted.

It also looks like the behind problem is only on elements further down the list. So I can drag to a "higher" sortable, but dragging to a "lower" sortable and the drag element is suddenly behind.

Details:

Given sortable list A each element in A in turns contains a connect sortable list B (as in the B lists in each A are all connected)

After sorting an element in A, elements dragged from the sortable living in this list are now behind the other A elements.

I have played around with the various z-index options via both CSS and Jquery to no avail.

like image 362
Toby Hede Avatar asked Sep 29 '11 05:09

Toby Hede


1 Answers

I found a workaround for this problem.

When defining your sortables, use:

appendTo: "body"
helper: "clone"

This breaks the dragged elements totally out of the nested sortable z-ordering and solves the problem.

like image 64
Toby Hede Avatar answered Oct 16 '22 00:10

Toby Hede