Seaside: Jquery cascade messages

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

Seaside: Jquery cascade messages

Bart Gauquie
Dear list,

I'm stuck at trying to do a cascade of messages on a jquery instance:
I want to do something like this:
$('<li id="newhere"><input type="checkbox" /><span class="listTitle">Im new here</span><ul></ul></li>')
 
.hide().prependTo('#container').slideDown("slow");

so some text, hide it, prepend to some container using some effect.


what I've already got is:

(html unorderedList)
id: 'tweets';
script:
((html jQuery ajax script: [ :s | s << (s jQuery html: [ :r | self renderTweetsOn: r ]) prependTo: (s jQuery id: #tweets)];
interval: 10 seconds));
with: [ self renderTweetsOn: html ]]

which just prepends without the effect.

If I update this to:
((html jQuery ajax script: [ :s | s << (s jQuery html: [ :r | self renderTweetsOn: r ]) hide; prependTo: (s jQuery id: #tweets)]; slideDown: 'slow';

it fails with error:

that JSScript>>prependTo: does not exist.
meaning that the hide message send returned a JSScript object instead of a JQueryInstance (which is what I expected to happen).

Any way to solve this?

Thanks for any pointers.

Kind Regards,

Bart

--
imagination is more important than knowledge - Albert Einstein
Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein
Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein
The true sign of intelligence is not knowledge but imagination. - Albert Einstein
However beautiful the strategy, you should occasionally look at the results. - Sir Winston Churchill
It's not enough that we do our best; sometimes we have to do what's required. - Sir Winston Churchill

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

Re: Seaside: Jquery cascade messages

Johan Brichau-2
Hi Bart,

The #prependTo: message is sent to 's' in the cascade. I think you mean this:

html jQuery ajax script: [ :s | s << ((((s jQuery html:  [ :r | self renderTweetsOn: r ]) hide prependTo: (s jQuery id: #tweets)) slideDown: 'slow')];

also watch out with the following pattern:

s << html jQuery keyword: #something

I have gotten burned by "forgetting" that binary messages are evaluated before keyword messages. The correct form is:

s << (html jQuery keyword: #something)

The strange thing is that it often works without the parentheses, but might go completely wrong when you concatenate the scripts (been there, done that :-).

cheers
Johan


On 03 Nov 2010, at 20:09, Bart Gauquie wrote:

> If I update this to:
> ((html jQuery ajax script: [ :s | s << (s jQuery html:  [ :r | self renderTweetsOn: r ]) hide; prependTo: (s jQuery id: #tweets)]; slideDown: 'slow';
>
>
> it fails with error:
>
> that JSScript>>prependTo: does not exist.
> meaning that the hide message send returned a JSScript object instead of a JQueryInstance (which is what I expected to happen).
>
> Any way to solve this?


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

Re: Seaside: Jquery cascade messages

Bart Gauquie
Thanks very much for this pointer.

It works if I do:
 (((s jQuery html:  [ :r | self renderTweetsOn: r ]) hide) prependTo: (s jQuery id: #tweets)) slideDown: 'slow'

if I leave the () out around hide, prependTo: , slideDown: then smalltalk says to me that prependTo: slideDown: message does not exist...

Kind Regards,

Bart

On Wed, Nov 3, 2010 at 8:26 PM, Johan Brichau <[hidden email]> wrote:
Hi Bart,

The #prependTo: message is sent to 's' in the cascade. I think you mean this:

html jQuery ajax script: [ :s | s << ((((s jQuery html:  [ :r | self renderTweetsOn: r ]) hide prependTo: (s jQuery id: #tweets)) slideDown: 'slow')];

also watch out with the following pattern:

s << html jQuery keyword: #something

I have gotten burned by "forgetting" that binary messages are evaluated before keyword messages. The correct form is:

s << (html jQuery keyword: #something)

The strange thing is that it often works without the parentheses, but might go completely wrong when you concatenate the scripts (been there, done that :-).

cheers
Johan


On 03 Nov 2010, at 20:09, Bart Gauquie wrote:

> If I update this to:
>       ((html jQuery ajax script: [ :s | s << (s jQuery html:  [ :r | self renderTweetsOn: r ]) hide; prependTo: (s jQuery id: #tweets)]; slideDown: 'slow';
>
>
> it fails with error:
>
> that JSScript>>prependTo: does not exist.
> meaning that the hide message send returned a JSScript object instead of a JQueryInstance (which is what I expected to happen).
>
> Any way to solve this?


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



--
imagination is more important than knowledge - Albert Einstein
Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein
Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein
The true sign of intelligence is not knowledge but imagination. - Albert Einstein
However beautiful the strategy, you should occasionally look at the results. - Sir Winston Churchill
It's not enough that we do our best; sometimes we have to do what's required. - Sir Winston Churchill

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