Re: bind onScroll event with Ajax call to body tag

Karsten Kusche <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.squeak.seaside
Message-ID <[email protected]>
Hi Sabine,

your code looks like:

html mdlLayoutContent onScroll: (html jQuery ajax script: [ :s | ... ]).

That creates two things:
html like this: <div id=„id123123“ class=„blah“></div>
javascript like: jQuery(„#id123123“).scroll(function(){jQuery.ajax….});

jQuery works by specifying a selector and then configuring the resulting objects. The selector is jQuery(„#123123“). It’ll try to find all objects with the specified ID. The configuration is the scroll-handler that you specified, it’ll be registered with the found objects.

Seaside helps here in several ways:
- when you send #onScroll: to the brush, it’ll automatically add a load-script so that the scroll-handler is registered.
- it’ll automatically register the scroll-handler for the current brush’s object, by using the brush’s ID.

As <body> cannot be accessed as a Brush, you have to do more manual work:
1. you need to add the load-script by hand (this is done by sending #addLoadScript: to the canvas’ document.
2. you need to create a jQuery instance that refers to the <body> object. This is done by calling (html jQuery: ‚body‘).
3. this jQuery instance also understands a #onScroll: method and it also registers the provided event handler.

You don’t need to modify the handler itself, it appears to return a script anyway and it doesn’t seem to do anything with the object that is scrolled.

So instead of:

html mdlLayoutContent onScroll: (html jQuery ajax script: [ :s | ... ]).

you call:

html document addLoadScript: ((html jQuery: ‚body‘) onScroll: (html jQuery ajax script: [ :s | ... ])).

Kind Regards
Karsten




Am 30. März 2017 um 13:58:44, Sabine Manaa ([email protected]<mailto:[email protected]>) schrieb:
Hi Karsten,

thank you for responding!

Sorry but I have to ask how to proceed,  how to call the handler there?

What to write after onScroll: ?

Regards
Sabine


2017-03-30 13:11 GMT+02:00 Karsten Kusche [via Smalltalk] <[hidden email]</user/SendEmail.jtp?type=node&node=4940539&i=0>>:
Hi Sabine,


html mdlLayoutContent
onScroll: (html jQuery ajax script: [ :s |
...do something with my model so I don't want use pure javascript... ]);
with: aBlock.


you can keep the handler and just register it with the body via:

html document addLoadScript: ((html jQuery:’body’) onScroll:…)

Kind Regards
Karsten

_______________________________________________
seaside mailing list
[hidden email]<http:///user/SendEmail.jtp?type=node&node=4940527&i=0>
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


________________________________
If you reply to this email, your message will be added to the discussion below:
http://forum.world.st/bind-onScroll-event-with-Ajax-call-to-body-tag-tp4940510p4940527.html
To start a new topic under Seaside General, email [hidden email]</user/SendEmail.jtp?type=node&node=4940539&i=1>
To unsubscribe from bind onScroll event with Ajax call to body tag, click here.
NAML<http://forum.world.st/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>


________________________________
View this message in context: Re: bind onScroll event with Ajax call to body tag<http://forum.world.st/bind-onScroll-event-with-Ajax-call-to-body-tag-tp4940510p4940539.html>
Sent from the Seaside General mailing list archive<http://forum.world.st/Seaside-General-f86180.html> at Nabble.com.
_______________________________________________
seaside mailing list
[email protected]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[email protected]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.