[Seaside] how to return to same position in page after #call?

Luc Damas luc.damas at univ-savoie.fr
Mon Sep 4 18:14:23 UTC 2006

I use javascript for this. Imagine you have a div named "divwithscroll" 
(overflow: scroll; in CSS).

Here is an example (multiple way to make it nice!). I don't know if you 
can put the "onscroll" attribute on the body...

MyApp>>renderContentOn: html

    html script: '
       function saveScroll() {
	 document.cookie = 
"pos="+document.getElementById("divwithscroll").scrollTop; }'.

    html attributeAt: 'onscroll' put: 'saveScroll();' ;
         divNamed: 'divwithscroll' with: [
             html render: self whatIWantToRender ].

    html attributeAt: 'name' put: 'scrollform' ; form: [
       html inputWithType: 'hidden' named: 'scrollpos' value: 'hop' ].
    html script: '
	function getpos() {
		d = document.cookie.indexOf("pos=");
		if (d == -1) { return 0; }
		f = document.cookie.indexOf(";", d+1);
		if (f == -1) { f = document.cookie.length }
		return document.cookie.substring(d+4,f);

Chuck Kasmire a écrit :
> I have a long list of items in a page and for each one
> I have an 'edit' anchor. When clicked this opens up an
> editor on that item. When the editor is closed, I
> would like to have the list page re-display itself
> such that the item just edited is visible. Currently,
> it goes back to the top of the page, so I have to
> scroll down and find it again. 
> Is there a way to return to the same position?
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

Luc Damas
Assistant professor
Condillac, LISTIC, ESIA
University of Savoie

More information about the Seaside mailing list