#onScroll: with positions

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

#onScroll: with positions

Dennis Schetinin
Hello, seasiders!

We would like to implement a GoogleReader-like table component which
loads additional data to the table while scrolling down to (or near)
the bottom. We tried #onScroll: event but it does not include position
parameters for scroller. The possible decision is to implement a
client-side script posting those parameters, but we are not sure how
to do it in practice.
Can anybody help us with it or maybe offer a better (simpler) solution
for original task?
Thanks in advance.

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

Re: #onScroll: with positions

Lukas Renggli
>  We would like to implement a GoogleReader-like table component which
>  loads additional data to the table while scrolling down to (or near)
>  the bottom. We tried #onScroll: event but it does not include position
>  parameters for scroller. The possible decision is to implement a
>  client-side script posting those parameters, but we are not sure how
>  to do it in practice.

Note that onScroll: is not a standard event, so most certainly it
won't work on all browsers. Never the less, you can try something like
the following:

    html div id: 'info'.
    self session addLoadScript: (html scriptaculous event
        observe: html scriptaculous window
        on: 'scroll' do: (html updater
            id: 'info';
            callback: [ :v | x := v ] value: (html scriptaculous
window access: 'scrollX');
            callback: [ :v | y := v ] value: (html scriptaculous
window access: 'scrollY');
            callback: [ :r | r render: x , ' x ' , y ])).

Cheers,
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: #onScroll: with positions

Dennis Schetinin
> >  We would like to implement a GoogleReader-like table component which
>  >  loads additional data to the table while scrolling down to (or near)
>  >  the bottom. We tried #onScroll: event but it does not include position
>  >  parameters for scroller. The possible decision is to implement a
>  >  client-side script posting those parameters, but we are not sure how
>  >  to do it in practice.
>
>
> Note that onScroll: is not a standard event, so most certainly it
>  won't work on all browsers. Never the less, you can try something like
>  the following:
>
>     html div id: 'info'.
>     self session addLoadScript: (html scriptaculous event
>         observe: html scriptaculous window
>         on: 'scroll' do: (html updater
>             id: 'info';
>             callback: [ :v | x := v ] value: (html scriptaculous
>  window access: 'scrollX');
>             callback: [ :v | y := v ] value: (html scriptaculous
>  window access: 'scrollY');
>             callback: [ :r | r render: x , ' x ' , y ])).
>

Thank you.

We found this decision:

(html div)
                ...
                onScroll: (html request callback: [:val | self halt]
                                        value: (SUStream on: 'this.scrollTop'));
                ...

Does it have many drawbacks?

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

Re: #onScroll: with positions

Dennis Schetinin
>  (html div)
>                 ...
>                 onScroll: (html request callback: [:val | self halt]
>                                         value: (SUStream on: 'this.scrollTop'));
>                 ...
>
>  Does it have many drawbacks?

val in block will have the desired value

--
Dennis Schetinin
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside