how to return to same position in page after #call?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

how to return to same position in page after #call?

Chuck Kasmire
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
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: how to return to same position in page after #call?

Luc Damas

Hi,
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
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


--
-------------------------
Luc Damas
Assistant professor
Condillac, LISTIC, ESIA
University of Savoie
France
http://ontology.univ-savoie.fr/luc.damas

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: how to return to same position in page after #call?

Lukas Renggli
In reply to this post by Chuck Kasmire
> Is there a way to return to the same position?

With Scriptaculous you can scroll to the old position, though that
involves some additional markup:

- add an id for every of your items anItem id
- do the call like this:
   self call: (BlaBla new item: anItem).
   self session effect scrollTo: anItem id

Lukas

>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: how to return to same position in page after #call?

Bakki Kudva
In reply to this post by Chuck Kasmire
How about doing the editing in a javascript pop up?

-bakki

On 9/4/06, Chuck Kasmire <[hidden email]> wrote:

> 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
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: how to return to same position in page after #call?

Chuck Kasmire
In reply to this post by Lukas Renggli
Thanks. I updated my seaside image so I can make use
of Scriptaculous. When I try to use #scrollTo: I am
getting an error:

SUEffect(Object)>>doesNotUnderstand: #scrollTo:

I don't see any method in SUEffect at all similar to
#scrollTo:. Am I missing something in the
installation?

The image I used was from Seaside.st:
- Seaside2.6b1-pmm.76
- Scriptaculous-lr.127

--- Lukas Renggli <[hidden email]> wrote:

> > Is there a way to return to the same position?
>
> With Scriptaculous you can scroll to the old
> position, though that
> involves some additional markup:
>
> - add an id for every of your items anItem id
> - do the call like this:
>    self call: (BlaBla new item: anItem).
>    self session effect scrollTo: anItem id
>
> Lukas


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: how to return to same position in page after #call?

Lukas Renggli
> I don't see any method in SUEffect at all similar to
> #scrollTo:. Am I missing something in the
> installation?

You need the very latest version of Scriptaculous, the functionality
got lost over time and I just recently re-added it:

Name: Scriptaculous-lr.132
Author: lr
Time: 29 August 2006, 5:27:55 pm
UUID: 61c02fc4-6cfb-4c79-b7d5-2e40512fd084
Ancestors: Scriptaculous-lr.131

- added scrolling to element and effect list

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: how to return to same position in page after #call?

Chuck Kasmire
I installed Scriptaculous-lr.133 (I tried lr.132 but
was getting some errors) but still getting:

SUEffect(Object)>>doesNotUnderstand: #scrollTo:

any ideas?

--- Lukas Renggli <[hidden email]> wrote:

> > I don't see any method in SUEffect at all similar
> to
> > #scrollTo:. Am I missing something in the
> > installation?
>
> You need the very latest version of Scriptaculous,
> the functionality
> got lost over time and I just recently re-added it:
>
> Name: Scriptaculous-lr.132
> Author: lr
> Time: 29 August 2006, 5:27:55 pm
> UUID: 61c02fc4-6cfb-4c79-b7d5-2e40512fd084
> Ancestors: Scriptaculous-lr.131
>
> - added scrolling to element and effect list
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> Seaside mailing list
> [hidden email]
>
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: how to return to same position in page after #call?

Lukas Renggli
> I installed Scriptaculous-lr.133 (I tried lr.132 but
> was getting some errors) but still getting:
>
> SUEffect(Object)>>doesNotUnderstand: #scrollTo:
>
> any ideas?

Ouch I am terribly sorry, I forgot to publish that change from a
private repository. I've merged the change now and it should be
accessible on SqueakSource:

Name: Scriptaculous-lr.135
Author: lr
Time: 6 September 2006, 8:05:25 am
UUID: bac4cc90-81b7-4195-846e-98b302a5de0f
Ancestors: Scriptaculous-lr.134, Scriptaculous-lr.132

And one more thing, the method is called #scroll and it can be used on
SUElement and SUEffect. So you have to do something like:

... effect
   id: 'element";
   scroll

HTH,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: how to return to same position in page after #call?

cbeler
In reply to this post by Chuck Kasmire
Hi

> 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?
>
>  
there is a way to do that without scriptaculous too with the latest
version of seaside. you need to name your item anchors:

html anchor
            name: 'item8';
             ...

and then on the anchor that close the editor you add:

html anchor
            fragment: 'item8';
            callback: []
            ...

and it should work

Cédrick
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside