[Seaside] Scriptacolous: How can I know the position of a dropped element ?

Lukas Renggli renggli at gmail.com
Tue Feb 13 18:16:09 UTC 2007


> I have a container where the user can drag & drop div elements. When the
> user drops an element,

The #onDrop: event of SUDroppable that passes you all the information you need:
the event object, the dragged element and the container element.

> I'd like to get the new element position (relative to
> the container), and store it in somewhere in the model.
> I tried to figure out how to get the element new position, but I couldn't.
> Any clues ?

Try something along the following untested code ...

html droppable
    ...
    onDrop: (html request
        callback: [ :p | p inspect ]
        value: (html element
            alias: 'arguments';
            property: 1;
            access: 'offsetTop')

... and you should get an inspector within the image giving you some
data about the dropped position.

Hope this helps,
Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the Seaside mailing list