Re: Dumb Question: How to render new state after ajax callbacks?

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

Re: Dumb Question: How to render new state after ajax callbacks?

Boris Popov, DeepCove Labs (SNN)
If your ajax callback will be forcing a full refresh, aren't you better off just doing a regular callback?

-Boris (via BlackBerry)


From: [hidden email] <[hidden email]>
To: Seaside - general discussion <[hidden email]>
Sent: Wed Nov 04 13:16:51 2009
Subject: Re: [Seaside] Dumb Question: How to render new state after ajax callbacks?


2009/10/15 Karsten <[hidden email]>
Hi Richard,

you can't do that with Ajax easily. The problem is that during an AJAX callback you're actually rendering and not in the normal callback phase.
You could however register a callback that does the answer and send Javascript back to the browser to make the browser jump to the callback's url. However, that's a bit tricky :-)
 
Hi.

Why It can not be implemented in simplest, user transparent way as Richard wrote? Or it can?
I think it's really usefull stuff.

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

Re: Dumb Question: How to render new state after ajax callbacks?

Julian Fitzell-2
And to be clear, if you really want, you should be able to use #show:
within an ajax callback, just not #call:. You should also be able to
use #answer: as long as the component was displayed with #show: and
not #call:. But of course, you'll still have to reload the page if you
want to see the result.

Doing a call in an ajax callback makes little sense because it would
abort the callback without you being able to generate a response
(normal callbacks redirect to another URL which generates the HTML
output).

Julian

On Wed, Nov 4, 2009 at 1:30 PM, Boris Popov <[hidden email]> wrote:

> If your ajax callback will be forcing a full refresh, aren't you better off
> just doing a regular callback?
>
> -Boris (via BlackBerry)
> ________________________________
> From: [hidden email]
> <[hidden email]>
> To: Seaside - general discussion <[hidden email]>
> Sent: Wed Nov 04 13:16:51 2009
> Subject: Re: [Seaside] Dumb Question: How to render new state after ajax
> callbacks?
>
>
> 2009/10/15 Karsten <[hidden email]>
>>
>> Hi Richard,
>>
>> you can't do that with Ajax easily. The problem is that during an AJAX
>> callback you're actually rendering and not in the normal callback phase.
>> You could however register a callback that does the answer and send
>> Javascript back to the browser to make the browser jump to the callback's
>> url. However, that's a bit tricky :-)
>
>
> Hi.
>
> Why It can not be implemented in simplest, user transparent way as Richard
> wrote? Or it can?
> I think it's really usefull stuff.
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dumb Question: How to render new state after ajax callbacks?

Richard Durr-2
Thanks for all the answers. Is it possible to get a refresh-url through javascript?

On Wed, Nov 4, 2009 at 11:12 PM, Julian Fitzell <[hidden email]> wrote:
And to be clear, if you really want, you should be able to use #show:
within an ajax callback, just not #call:. You should also be able to
use #answer: as long as the component was displayed with #show: and
not #call:. But of course, you'll still have to reload the page if you
want to see the result.

Doing a call in an ajax callback makes little sense because it would
abort the callback without you being able to generate a response
(normal callbacks redirect to another URL which generates the HTML
output).

Julian

On Wed, Nov 4, 2009 at 1:30 PM, Boris Popov <[hidden email]> wrote:
> If your ajax callback will be forcing a full refresh, aren't you better off
> just doing a regular callback?
>
> -Boris (via BlackBerry)
> ________________________________
> From: [hidden email]
> <[hidden email]>
> To: Seaside - general discussion <[hidden email]>
> Sent: Wed Nov 04 13:16:51 2009
> Subject: Re: [Seaside] Dumb Question: How to render new state after ajax
> callbacks?
>
>
> 2009/10/15 Karsten <[hidden email]>
>>
>> Hi Richard,
>>
>> you can't do that with Ajax easily. The problem is that during an AJAX
>> callback you're actually rendering and not in the normal callback phase.
>> You could however register a callback that does the answer and send
>> Javascript back to the browser to make the browser jump to the callback's
>> url. However, that's a bit tricky :-)
>
>
> Hi.
>
> Why It can not be implemented in simplest, user transparent way as Richard
> wrote? Or it can?
> I think it's really usefull stuff.
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


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

Re: Dumb Question: How to render new state after ajax callbacks?

Julian Fitzell-2
You could use #refresh on either SUScript or JSScript (depending on
the version of Seaside) to cause a refresh of the page.

For example (in 3.0a5):

html submitButton
        onClick: (html jQuery ajax script: [ :s | s refresh ]);
        with: 'Refresh the page'.

So you could swap out a component with the following code, though I'm
not sure why you'd want to do it this way... (I guess it allows the
refresh to be optional depending on whether you actually end up doing
a #show: or not?)

html submitButton
        onClick: (html jQuery ajax
                script: [ :s | self show: WACounter new. s refresh ]);
        with: 'Show a counter'.

Julian

On Wed, Nov 4, 2009 at 3:28 PM, Richard Durr
<[hidden email]> wrote:

> Thanks for all the answers. Is it possible to get a refresh-url through
> javascript?
>
> On Wed, Nov 4, 2009 at 11:12 PM, Julian Fitzell <[hidden email]> wrote:
>>
>> And to be clear, if you really want, you should be able to use #show:
>> within an ajax callback, just not #call:. You should also be able to
>> use #answer: as long as the component was displayed with #show: and
>> not #call:. But of course, you'll still have to reload the page if you
>> want to see the result.
>>
>> Doing a call in an ajax callback makes little sense because it would
>> abort the callback without you being able to generate a response
>> (normal callbacks redirect to another URL which generates the HTML
>> output).
>>
>> Julian
>>
>> On Wed, Nov 4, 2009 at 1:30 PM, Boris Popov <[hidden email]>
>> wrote:
>> > If your ajax callback will be forcing a full refresh, aren't you better
>> > off
>> > just doing a regular callback?
>> >
>> > -Boris (via BlackBerry)
>> > ________________________________
>> > From: [hidden email]
>> > <[hidden email]>
>> > To: Seaside - general discussion <[hidden email]>
>> > Sent: Wed Nov 04 13:16:51 2009
>> > Subject: Re: [Seaside] Dumb Question: How to render new state after ajax
>> > callbacks?
>> >
>> >
>> > 2009/10/15 Karsten <[hidden email]>
>> >>
>> >> Hi Richard,
>> >>
>> >> you can't do that with Ajax easily. The problem is that during an AJAX
>> >> callback you're actually rendering and not in the normal callback
>> >> phase.
>> >> You could however register a callback that does the answer and send
>> >> Javascript back to the browser to make the browser jump to the
>> >> callback's
>> >> url. However, that's a bit tricky :-)
>> >
>> >
>> > Hi.
>> >
>> > Why It can not be implemented in simplest, user transparent way as
>> > Richard
>> > wrote? Or it can?
>> > I think it's really usefull stuff.
>> >
>> > _______________________________________________
>> > seaside mailing list
>> > [hidden email]
>> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>> >
>> >
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside