[Seaside] Detect the position of a page div

Robert Sirois watchlala at hotmail.com
Tue Sep 22 19:36:19 UTC 2009


Dang! That's cool. I was hoping the callbacks would return something for "#html:". Thanks for the help! Ill play around with it when I get home.

So "#text:" doesn't expect the same thing as "#html:" then?

Oh, also. I recall a comment somewhere that you can only register one callback on a class? Does that only apply to seaside components?

Thanks!
RS

> Date: Tue, 22 Sep 2009 19:20:54 +0200
> Subject: Re: [Seaside] Detect the position of a page div
> From: renggli at gmail.com
> To: seaside at lists.squeakfoundation.org
> 
> There is a bit too much nested AJAX going on for me ;-)
> 
> >         script: ((html jQuery new draggable) onDrag: (
> >
> >                 (html jQuery ajax script: [:s | s add: ((s jQuery: #bobLeft)
> > html: (s jQuery ajax callback: [(s jQuery: #bob) offset access: 'left']))]),
> >                 (html jQuery ajax script: [:s | s add: ((s jQuery: #bobTop)
> > html: (s jQuery ajax callback: [(s jQuery: #bob) offset access: 'top']))])
> >
> >             )
> >         );
> 
> The message #html: expects aRenderable, such as a block or a string of
> HTML, something that is generated by Seaside on the server. In your
> case you just display the script and that is what you see in the
> browser.
> 
> If you replace #html with #text: and remove the roundtrip to the
> server this should already work:
> 
>   (html jQuery ajax script: [:s | s add: ((s jQuery: #bobLeft) text:
> ((s jQuery: #bob) offset access: 'left'))]),
>   (html jQuery ajax script: [:s | s add: ((s jQuery: #bobTop) text:
> ((s jQuery: #bob) offset access: 'top'))])
> 
> Now it displays the coordinates, but very much delayed as the script
> makes two round-trips to the server whenever you move the draggable
> element. In fact, this round-trip is not needed at all. If you remove
> all AJAX code the script becomes much simpler and faster. Furthermore,
> if you use the navigation facilities of jQuery you don't need any of
> the IDs and the script becomes:
> 
> html div
> 	script: (html jQuery new draggable onDrag:
> 		((html jQuery this find: ':first') text: (html jQuery this offsetLeft)) ,
> 		((html jQuery this find: ':last') text: (html jQuery this offsetTop)));
> 	with: [ html div: 'left'; div: 'top' ]
> 
> Note, I use #offsetLeft and #offsetTop here, two methods I added to
> jQuery this morning after your post. You might want to update to the
> latest code, or replace the calls with the old code  #access:
> 
> Cheers,
> 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

_________________________________________________________________
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
http://clk.atdmt.com/GBL/go/171222985/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20090922/28ec7d75/attachment.htm


More information about the seaside mailing list