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

Martin Rubi mrubi at fibertel.com.ar
Tue Feb 13 19:06:15 UTC 2007


Lukas, it's exactly what I was looking for.
Many thanks !!

best regards
martin

----- Original Message ----- 
From: Lukas Renggli
To: The Squeak Enterprise Aubergines Server - general discussion.
Sent: Tuesday, February 13, 2007 3:16 PM
Subject: Re: [Seaside] Scriptacolous: How can I know the position of a 
droppedelement ?


> 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
_______________________________________________
Seaside mailing list
Seaside at lists.squeakfoundation.org
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside 



More information about the Seaside mailing list