Rendering vs. Callback (was: Re: RE: seaside Digest, Vol 78, Issue 21)

13 messages Options
Embed this post
Permalink
Lukas Renggli

Rendering vs. Callback (was: Re: RE: seaside Digest, Vol 78, Issue 21)

Reply Threaded More More options
Print post
Permalink
> If I update an instance variable without using a callback or similar block,
> it will not update, correct?

It depends what you want to do?

If you want to count the number of times the page is generated, then
it will work.

If you want to count the number of times a certain link is clicked,
then you need a callback.

Btw, Slime points out such possible issues.

> whereas this does not:
> html anchor
> onClick: (self clickFunction: html onItem: (self resultList at: self
> curItem));
> text: 'Next Question'

The code you pass to #onClick: is evaluated when the page is
generated. If you don't know the action in advance, you need to do a
callback to the server. You can do this for example with an AJAX call
that returns a script:

html anchor
    onClick: (html jQuery ajax script: [ :script |
        script add: (script jQuery: '#foo') effect explode ]);
    with: 'A link'

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Robert Sirois

RE: Rendering vs. Callback (was: Re: RE: seaside Digest, Vol 78, Issue 21)

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Nice, thanks :)

I got everything working how I would like it except one little issue.

The behavior I expected from this, would be to show the little square via the #explode effect. Whether set to toggle or show, it only does the hide transition. If I just have show, it works as expected.

html anchor
onClick: ((html jQuery: '#foo') show, (html jQuery: '#foo') effect explode);
with: 'test'.
html break.
html div
id: 'foo';
script: html jQuery this hide;
style: 'width: 50px; height: 50px; background: purple'.

Thanks, RS


Lauren found her dream laptop. Find the PC that’s right for you.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Lukas Renggli

Re: Rendering vs. Callback (was: Re: RE: seaside Digest, Vol 78, Issue 21)

Reply Threaded More More options
Print post
Permalink
Seems to be strange to do a show and an explode on the same element. I
think the explode animation already does a show. No?

Lukas

On Wed, Jun 17, 2009 at 6:33 PM, Robert Sirois<[hidden email]> wrote:

> Nice, thanks :)
> I got everything working how I would like it except one little issue.
> The behavior I expected from this, would be to show the little square via
> the #explode effect. Whether set to toggle or show, it only does the hide
> transition. If I just have show, it works as expected.
> html anchor
> onClick: ((html jQuery: '#foo') show, (html jQuery: '#foo') effect explode);
> with: 'test'.
> html break.
> html div
> id: 'foo';
> script: html jQuery this hide;
> style: 'width: 50px; height: 50px; background: purple'.
> Thanks, RS
> ________________________________
> Lauren found her dream laptop. Find the PC that’s right for you.
> _______________________________________________
> 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
Robert Sirois

RE: Rendering vs. Callback (was: Re: RE: seaside Digest, Vol 78, Issue 21)

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Has the same effect using just the effect.

onClick: ((html jQuery: '#foo') effect explode);

RS


Microsoft brings you a new way to search the web. Try Bing™ now
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Lukas Renggli

Re: Rendering vs. Callback (was: Re: RE: seaside Digest, Vol 78, Issue 21)

Reply Threaded More More options
Print post
Permalink
Maybe you are missing the JQueryUI libraries, explode is part of JQueryUI?

Any messages from FireBug?

Lukas

On Wed, Jun 17, 2009 at 6:38 PM, Robert Sirois<[hidden email]> wrote:

> Has the same effect using just the effect.
> onClick: ((html jQuery: '#foo') effect explode);
> RS
> ________________________________
> Microsoft brings you a new way to search the web. Try Bing™ now
> _______________________________________________
> 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
Robert Sirois

RE: Rendering vs. Callback (was: Re: RE: seaside Digest, Vol 78, Issue 21)

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
I have both JQDevelopment/Deployment and JQUiDevelopment/Deployment libraries on. I'm not positive, but I believe the effects are part of JQUi.

What's happening is that the transition is occurring, only it is, well, exploding (thus, hiding the already hidden div). So it must show it and then hide it, or it is always hidden, but the transition is viewable. The div "fragments" are flying away... so I can tell by that.

I am testing on Windows so I only have Chrome at the moment.

<a onclick="$(&quot;#foo&quot;).effect(&quot;explode&quot;,{})">test</a>
<br/>
<div id="foo" style="width: 50px; height: 50px; background: purple"></div>

The javascript looks good, though.

RS

> Date: Wed, 17 Jun 2009 18:42:54 +0200
> Subject: Re: Rendering vs. Callback (was: Re: [Seaside] RE: seaside Digest, Vol 78, Issue 21)
> From: [hidden email]
> To: [hidden email]
>
> Maybe you are missing the JQueryUI libraries, explode is part of JQueryUI?
>
> Any messages from FireBug?
>
> Lukas
>
> On Wed, Jun 17, 2009 at 6:38 PM, Robert Sirois<[hidden email]> wrote:
> > Has the same effect using just the effect.
> > onClick: ((html jQuery: '#foo') effect explode);
> > RS
> > ________________________________
> > Microsoft brings you a new way to search the web. Try Bing™ now
> > _______________________________________________
> > 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


Microsoft brings you a new way to search the web. Try Bing™ now
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Robert Sirois

jQuery - ajax setting temporary or ivars

Reply Threaded More More options
Print post
Permalink
In reply to this post by Lukas Renggli
Some javascript/style in this post has been disabled (why?)
Can I use ajax post or something like that to set variables on the component in an 'onClick:' message?



Thanks :)
RS


Hotmail® has ever-growing storage! Don’t worry about storage limits. Check it out.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Lukas Renggli

Re: jQuery - ajax setting temporary or ivars

Reply Threaded More More options
Print post
Permalink
> Can I use ajax post or something like that to set variables on the component
> in an 'onClick:' message?

Of course. Have a look at the functional tests, for example
JQCounterFunctionalTest.

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Robert Sirois

RE: jQuery - ajax setting temporary or ivars

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
That's fairly elaborate. I was looking to just set a variable without rendering or changing anything, that way, later on, I can use it in it's changed state.

RS



> Date: Sat, 20 Jun 2009 22:57:05 +0200
> Subject: Re: [Seaside] jQuery - ajax setting temporary or ivars
> From: [hidden email]
> To: [hidden email]
>
> > Can I use ajax post or something like that to set variables on the component
> > in an 'onClick:' message?
>
> Of course. Have a look at the functional tests, for example
> JQCounterFunctionalTest.
>
> Cheers,
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


Hotmail® has ever-growing storage! Don’t worry about storage limits. Check it out.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Lukas Renggli

Re: jQuery - ajax setting temporary or ivars

Reply Threaded More More options
Print post
Permalink
#html: and #script: are just helper methods around the more primitive
#callback: method. If you don't want to generate a response (though an
empty one will happen in any case) or do something special simply use
#callback:

Lukas

On Saturday, June 20, 2009, Robert Sirois <[hidden email]> wrote:

>
>
>
>
>
> That's fairly elaborate. I was looking to just set a variable without rendering or changing anything, that way, later on, I can use it in it's changed state.
>
> RS
>
>
>
>> Date: Sat, 20 Jun 2009 22:57:05 +0200
>> Subject: Re: [Seaside] jQuery - ajax setting temporary or ivars
>> From: [hidden email]
>> To: [hidden email]
>>
>> > Can I use ajax post or something like that to set variables on the component
>> > in an 'onClick:' message?
>>
>> Of course. Have a look at the functional tests, for example
>> JQCounterFunctionalTest.
>>
>> Cheers,
>> Lukas
>>
>> --
>> Lukas Renggli
>> http://www.lukas-renggli.ch
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
> Hotmail® has ever-growing storage! Don’t worry about storage limits. Check it out. <http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009>
>

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Robert Sirois

RE: jQuery - ajax setting temporary or ivars

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
I guess I'm confused about the way Ajax works. Isn't it typically for loading/uploading files from/to the server? In the Smalltalk Seaside environment the variables are various Object types, so it is getting and setting those in the same fashion?

RS

> Date: Sat, 20 Jun 2009 23:39:10 +0200
> Subject: Re: [Seaside] jQuery - ajax setting temporary or ivars
> From: [hidden email]
> To: [hidden email]
>
> #html: and #script: are just helper methods around the more primitive
> #callback: method. If you don't want to generate a response (though an
> empty one will happen in any case) or do something special simply use
> #callback:
>
> Lukas
>
> On Saturday, June 20, 2009, Robert Sirois <[hidden email]> wrote:
> >
> >
> >
> >
> >
> > That's fairly elaborate. I was looking to just set a variable without rendering or changing anything, that way, later on, I can use it in it's changed state.
> >
> > RS
> >
> >
> >
> >> Date: Sat, 20 Jun 2009 22:57:05 +0200
> >> Subject: Re: [Seaside] jQuery - ajax setting temporary or ivars
> >> From: [hidden email]
> >> To: [hidden email]
> >>
> >> > Can I use ajax post or something like that to set variables on the component
> >> > in an 'onClick:' message?
> >>
> >> Of course. Have a look at the functional tests, for example
> >> JQCounterFunctionalTest.
> >>
> >> Cheers,
> >> Lukas
> >>
> >> --
> >> Lukas Renggli
> >> http://www.lukas-renggli.ch
> >> _______________________________________________
> >> seaside mailing list
> >> [hidden email]
> >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> > Hotmail® has ever-growing storage! Don’t worry about storage limits. Check it out. <http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009>
> >
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


Lauren found her dream laptop. Find the PC that’s right for you.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Lukas Renggli

Re: jQuery - ajax setting temporary or ivars

Reply Threaded More More options
Print post
Permalink
> I guess I'm confused about the way Ajax works. Isn't it typically for
> loading/uploading files from/to the server?

Ajax works always works like this: It is a Javascript that does a
request on the server. What the server does with the request and what
the Javascript does with the response is up to you.

For example the following code

    html div
        onClick: (html ajax callback: [ count := count + 1 ]);
        with: 'Click Me'

increments 'count' whenever somebody clicks on the element, otherwise
nothing happens.

To also update the element you have to render some HTML, like this:

    html div
        onClick: (html this load html: [ :r | r render: (count := count + 1) ])
        with: 'Click Me'

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Robert Sirois

RE: jQuery - ajax setting temporary or ivars

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Ah, thank you very much Lukas. I was operating under the assumption that I could use a temporary variable and it just occurred to me I may have been wrong (which, of course, I was).

RS

> Date: Sun, 21 Jun 2009 11:29:51 +0200
> Subject: Re: [Seaside] jQuery - ajax setting temporary or ivars
> From: [hidden email]
> To: [hidden email]
>
> > I guess I'm confused about the way Ajax works. Isn't it typically for
> > loading/uploading files from/to the server?
>
> Ajax works always works like this: It is a Javascript that does a
> request on the server. What the server does with the request and what
> the Javascript does with the response is up to you.
>
> For example the following code
>
> html div
> onClick: (html ajax callback: [ count := count + 1 ]);
> with: 'Click Me'
>
> increments 'count' whenever somebody clicks on the element, otherwise
> nothing happens.
>
> To also update the element you have to render some HTML, like this:
>
> html div
> onClick: (html this load html: [ :r | r render: (count := count + 1) ])
> with: 'Click Me'
>
> Cheers,
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


Microsoft brings you a new way to search the web. Try Bing™ now
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside