Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here's a quick workaround to get this working:</p> <p>I ended up using only one DIV which is a <code>dojo.dnd.Source</code> and contains the items that should be dropped into a "dropZone" and moved around in it while snapping back to the item-list when placed outside the dropZone.</p> <p>All items are a <code>dojo.dnd.move.parentConstrainedMoveable</code> to make them movable in the originating DIV. Connecting to <code>onMoveStop</code> will give me the opportunity to decide whether the "drop" has occured in the dropZone or somewhere else.</p> <pre><code> if (coordX &gt;= (dropCoords.l + dropAreaX) &amp;&amp; coordX &lt;= (dropCoords.l + dropAreaX + dropAreaW) &amp;&amp; coordY &gt;= (dropCoords.t + dropAreaY) &amp;&amp; coordY &lt;= (dropCoords.t + dropAreaY + dropAreaH)) { // OK! } else { // outside, snap back to list } </code></pre> <p><code>dropAreaX</code> and <code>dropAreaY</code> contain the coordinates where the dropZone starts, <code>dropAreaW</code> and <code>dropAreaH</code> contain its width and height.</p> <p>If "OK!", the items will be saved into an array, so I know which items have been dropped. Otherwise the item will be removed from that array (if it's in there) and the item will be placed back into the list (via CSS "left: 0"). The number of elements in the array will tell me how many elements are left in the list, so I can "stack" them in a loop using "top: numberOfElement * heightOfElement px").</p> <p>There's more to it as I need the items coordinates written to hidden fields, but I guess this should get anybody who's working on a similar problem on the right track.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload