Hi Sabine,
Oh you're right that is an integral part. Sorry I left it out earlier.
It looks like this:
renderMoreItems: someResults from: aRequest at: anId on: html | itemsToRender | itemsToRender := self checkMoreResultsComplete: someResults. itemsToRender isNil ifTrue: [ html script: (((html jQuery id: anId) registeredInterval) delay: 2 seconds; func: (html jQuery ajax script: [ :s | s << ((s jQuery class: 'results:visible:last') replaceWith: [ :h | self renderMoreItems: someResults from: aRequest at: anId on: h ]) ])). (html div) class: 'results'; with: [ html heading level2 with: [ html render: 'waiting for results .... '. html image resourceUrl: '/img/icon-loader.gif' ] ] ] ifFalse: [ html script: (html jQuery id: anId) registeredInterval. itemsToRender := itemsToRender copy select: [ :each | self filterItem: each ]. itemsToRender isEmpty ifTrue: [ self renderNoMoreItemsError: html ] ifFalse: [ self renderItems: itemsToRender on: html self renderEndlessScroll: html with: aRequest with: anId ] ]
The someResults object is a future from http://www.squeaksource.com/Futures.html. The #registeredInterval script is just a throwaway script that creates creates a js setInterval and stores it in the DOM to poll whether the future has results or not. Sending it with no arguments clears the interval. If I were writing it again I'd just use setTimeout to do the polling. But thats all orthogonal to your question.
Hope this helps
Paul
Sabine Manaa wrote
Hi Paul,
thanks for sharing. I try to use it.
I think there is a typo in
method ^'endessScroll' ==> 'endlessScroll'
Could you please send me a piece of code what your
self renderMoreItems: moreItems from: aRequest at: id on: h
does?
Regards Sabine
-- View this message in context: http://forum.world.st/Infinite-Scrolling-tp4821669p4894337.html Sent from the Seaside General mailing list archive at Nabble.com.
seaside@lists.squeakfoundation.org